► Python program that accepts an integer (n) and computes the value of n+nn+nnn

Steps followed:

1. get the value of n from the user

2. convert n,nn,nnn to integer and calculate the value for n+nn+nnn and store in variable comp

3. print the value of comp i.e. n+nn+nnn

Program

#Python program that accepts an integer (n) and computes the value of n+nn+nnn

# get the value of n from the user

n = input("enter value for n :")

# convert n,nn,nnn to integer and calculate the value for n+nn+nnn and store in variable comp

comp = int(n)+int(n+n)+int(n+n+n)

#print the value of comp i.e. n+nn+nnn

print("calculated value for n+nn+nnn is :",comp)

Output

enter value for n :9

calculated value for n+nn+nnn is : 1107

enter value for n :10

calculated value for n+nn+nnn is : 102030

Also Read: