+ 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

7th Jul 2018, 8:07 PM
Parthiban03 000
Parthiban03 000 - avatar
5 Answers
+ 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])
8th Jul 2018, 6:44 AM
Brandon Bradshaw
Brandon Bradshaw - avatar
+ 3
You can check out my example code i made a while back https://code.sololearn.com/c17A83Q6v7il/?ref=app
8th Jul 2018, 6:47 AM
Brandon Bradshaw
Brandon Bradshaw - avatar
+ 1
super bro
8th Jul 2018, 7:09 AM
Parthiban03 000
Parthiban03 000 - avatar
0
print(mango)
7th Jul 2018, 9:08 PM
TurtleShell
TurtleShell - avatar
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
8th Jul 2018, 2:49 AM
Parthiban03 000
Parthiban03 000 - avatar