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


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

Solution

def custom(n):
    a = n
    n1 = int("%s" % a)
    n2 = int("%s%s" % (a, a))
    n3 = int("%s%s%s" % (a, a, a))
    return n1 + n2 + n3
print(custom(20))



List all Python Programs