This is a Python Program to read a number n and compute n+nn+nnn.
The program takes a number n and computes n+nn+nnn.
Here is the source code of the Python Program to read a number n and compute n+nn+nnn. The program output is also shown below.
n=int(input("Enter a number n: "))
print("The value is:",comp)
1. User must first enter the value and store it in a variable n.
2. The integer is converted to string for concatenation of the value of n.
3. The string is then concatenated once and twice and stored in separate variables.
4. Later to find the total sum, the string is converted back to integer.
5. The total value of the expression is then printed.