satya

Tuesday, October 6, 2020

Program-10

                                                                               Program-10

10) Write a program that asks the user for a large integer and inserts commas into it according to  the standard American convention for commas in large numbers. For  instance, if the user   enters 1000000, the output should be 1,000,000.


number=int(input("Enter the Long integer:"))

print("{:,}".format(number)) 


OUTPUT:

======== RESTART: D:\old\r19 lab-python\10.py =============

Enter the Long integer:1000000

1,000,000

>>> ==RESTART: D:\old\r19 lab-python\10.py ===============

Enter the Long integer:33000

33,000
>>> 

No comments:

Post a Comment

Program 30

                                                                         Program 30 Write a Python class to implement pow(x, n). class Pow1:...