0

d1 = { "go":"went","come":"Came","stars":"above the sky" ,"wat ":"drinkable","fire ": " hot"} a = input( "enter your word :")

print(d1[ ]) go and come is printing but wat and fire os not printing why

27th Apr 2020, 12:18 PM
Shourya Pandey
Shourya Pandey - avatar
3 Respostas
+ 2
d1 = { "go":"went","come":"Came","stars":"above the sky" ,"wat":"drinkable","fire": " hot"} a = input( "enter your word :") print(d1[a]) The error was coming because there was extra space in "fire" and "wat" Now it works properly. Try the above code ...
27th Apr 2020, 12:23 PM
ANJALI SAHU
+ 1
~ swim ~ actually he wants to print(d1[a])
27th Apr 2020, 12:28 PM
ANJALI SAHU
+ 1
Yup looks like he wants to print d1[a] and the error was because of space in key
27th Apr 2020, 12:30 PM
Abhay
Abhay - avatar