Read a Number n and Compute n+nn+nnn in Python

In this Python program, we will have a look at how to read a number n & compute n+nn+nnn in python.

Python Program To Read a Number n and Compute n+nn+nnn in Python

n=int(input("Please enter a number n: "))
temp=str(n)
a1=temp+temp
a2=temp+temp+temp
comp=n+int(a1)+int(a2)
print("The value is:",comp) 

Output:

Pease enter a number n: 5
The value is: 615

Leave a Reply

Shopping cart