+ 1
How to print the content within an input?
for eg: mango=fruit if mango was the input we get from the user we had to print fruit how can i do it
5 Respostas
+ 3
So for this you might want to create a dictionary. You could do
dict = {“mango”:”fruit”,
“crow”:”bird”, “tiger”:”animal”}
n=input()
print(dict[n])
+ 3
You can check out my example code i made a while back
https://code.sololearn.com/c17A83Q6v7il/?ref=app
+ 1
super bro
0
print(mango)
0
in single content ok what if in this case
mango=fruit
carrot=vegetable
Crow=bird
tiger=animal
n=input()
here we must print the right side when left side given as input by someone how can we do it for eg: if Crow was the input the output must be bird