Python Program To Format The Number

Write Python code to format the number

# WAP to User of Formatting the Number

n = int(input("Enter the floating point number :--> "))

print("\nThe floating point number is : %f" % n)
print("The floating point number is : %.2f" % n)
print("The floating point number is : %10.4f" % n)

# 10 is for total size and right align

Output:

Enter the floating point number :--> 56

The floating point number is : 56.000000
The floating point number is : 56.00
The floating point number is :    56.0000

<< Previous | Next >>


Leave a Reply

Your email address will not be published.