Write a short program to input a digit and print it in words in python

it computer guruji

write a short program to input a digit and print it in words in python

----------------------------------------------------------------
Solution:-

num=int(input("Enter the digit from 0 to 9  :  "))
print("Entered Digit is  :  ",end='')
if num==0:
    print("Zero")
elif num==1:
    print("One")
elif num==2:
    print("Two")
elif num==3:
    print("Three")
elif num==4:
    print("Four")
elif num==5:
    print("Five")
elif num==6:
    print("Six")
elif num==7:
    print("Seven")
elif num==8:
    print("Eight")
elif num==9:
    print("Nine")
else:
    print("Out of Range")

-----------------------------------------
Output-1

Enter the digit from 0 to 9  :  6
Entered Digit is  :  Six
-----------------------------------------
Output-2

Enter the digit from 0 to 9  :  15
Entered Digit is  :  Out of Range

Post a Comment

0 Comments