1.

Write a program to print integers with ‘*’ on the right of specified width?

Answer»

x = 1 2 3

print (“original number: “ , x)

print (“formatted number(right padding, width 6): “+” {: * < 7 d}”.format(x));

Output:

original number : 1 2 3

formatted number (right padding, width 6): 1 2 3 ***



Discussion

No Comment Found