Computer Science, asked by ChitranjanSrivastava, 2 months ago

create a python program to get the value entered by a user between 1 to 10 and print the corresponding number name​

Answers

Answered by allysia
3

Language:

Python

Program:

a=int(input("Enter a number: "))

d={0:"Zero",1:"One",2:"Two",3:"Three", 4:"Four", 5:"Five", 6:"Six", 7:"Seven", 8:"Eight", 9:"Nine", 10:"Ten"}

try:

   print(d[a])

except:

   print ("Enter numbers un range 0-10")

Output:

Consider the attachments.

Explanation:

  • Take input within range 0-10 in a variable .
  • Make a dictionary with Keys as the numbers in range with respective values.
  • Get the variable to extract the value.

Attachments:

Attachments:
Similar questions