Table of Contents
Python Exercise 15 Problem
In this Python exercise, write a Python program that computers the value of n+nn+nnn with the input of an integer.
For example, if a user entered the integer 5, it should computed the value of as 5+55+555 = 615.
Solution Python Exercise 15
Python Code Input:
n = input("Enter an integer: ") n1 = int(f"{n}") n2 = int(f"{n}{n}") n3 = int(f"{n}{n}{n}") n4 = n1+n2+n3 print(n1) print(n2) print(n3) print(f"Computed value of {n1}+{n2}+{n3} = {n4} ")
User Input:
Enter an integer: 8
Python Code Output:
8 88 888 Computed value of 8+88+888 = 984