Would Write Code Python Takes Input Five Letters Coverts Lowercase Prints Corresponding Nu Q37260200

how would I write a code in python that takesinput as five letters (coverts it to lowercase) and prints itscorresponding numbers from a dictionary

input_user= input (‘enter four letters: ‘)

dictionary= {‘a’:2, ‘b’:4, ‘c’: 9, ‘d’: 3, ‘e’:2}


Answer


Please find the code below:::

回getAverage |回printFrom Dict X 1 input_user- input enter four letters:) 2 dictionary- a:2, b :4, c: 9, d: 3, e:2 3

input_user= input (‘enter four letters: ‘)
dictionary= {‘a’:2, ‘b’:4, ‘c’: 9, ‘d’: 3, ‘e’:2}
for letter in input_user:
if letter in dictionary:
print(“For letter %c number is%d”%(letter,dictionary[letter]))
else:
print(“Letter %c is not in the dictionary”%letter)

output:

Console 3 er four letters: ab 

<div class=

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.