Problem in project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Problem in project

Can’t see what’s wrong it goes but does not give rite out put Sound =input() if Sound=='Grr': print ('Lion') elif Sound=='Rawr': print ('Tiger') elif Sound=='Ssss': print ('Snake') elif Sound=='Chirp': print ('Bird ') New. Don’t understand y I need to put sound=input And what do I do that if someone puts in lion lion twice it should print 2 times

24th Aug 2021, 9:38 PM
Lz1234
14 Answers
25th Aug 2021, 10:59 PM
Mahad Ahmed
Mahad Ahmed - avatar
+ 2
https://code.sololearn.com/c2oBSk4n53uV/
24th Aug 2021, 10:42 PM
Mahad Ahmed
Mahad Ahmed - avatar
+ 1
SoloProg Jay Matthews Im not useing any of the reseved words
25th Aug 2021, 1:38 AM
Lz1234
+ 1
Mahad Ahmed Your sound in the forest dose not work Put in Lion Lion And it said no out put
25th Aug 2021, 5:05 PM
Lz1234
+ 1
Jay Matthews Can you explain in simple termanoligy y i need to do this sound =input get that thats the way but i want to understand y
25th Aug 2021, 5:35 PM
Lz1234
+ 1
Thanx
25th Aug 2021, 9:07 PM
Lz1234
+ 1
You fix it nice
25th Aug 2021, 11:24 PM
Lz1234
+ 1
Lz1234 Does this work? :- inp = input().lower().split() sounds = { "lion" : "grr", "tiger" : "rawr", "snake" : "ssss", "bird" : "chirp" } a, b = tuple(zip(*sounds.items())) for x in inp: print(a[b.index(x)] if x in b else x, end=" ")
26th Aug 2021, 2:43 AM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Hello. If you want the name of the animal that makes this sound to be displayed N times when you enter the name of the sounds N times, use my code: https://code.sololearn.com/cwUe3xJ7ynA0/?ref=app
26th Aug 2021, 9:35 PM
𝗘𝘅𝘁𝗿𝗲𝗲𝗺𝗚𝗮𝗺𝗲𝗿
𝗘𝘅𝘁𝗿𝗲𝗲𝗺𝗚𝗮𝗺𝗲𝗿 - avatar
0
Lz1234 I suggest you to use a dictionary here.
25th Aug 2021, 4:44 AM
Calvin Thomas
Calvin Thomas - avatar
0
Jay Matthews K get that if you dont mined can you tell me what to do that if some one puts in more than one sound it shold give both rasolts ex(Grr Chirp the out put shuld be Lion Bird )ass of now it only goes once
25th Aug 2021, 8:50 PM
Lz1234
0
Most of the answer has been explained very nicely by Jay Matthews , just to clear the basics (afaik, I can be wrong, but I learnt at FreeCodeCamp): when you write the statement "input()" you basically are giving instruction(s) for the processor chip to handle, 'do this and that'. However think about it, did you asked the processor to 'maintain the input obtained in the memory(RAM) retrievable by me'? If you stress on it, you will find that this won't make sense unless you could have a sort book keeping label for that memory piece, that book keeping label is a variable assignment :)
26th Aug 2021, 5:02 PM
scientist
scientist - avatar
0
You can change sound into any no problem bro
26th Aug 2021, 6:08 PM
yuvraj Sahu
yuvraj Sahu - avatar
- 1
dawtw
29th Aug 2021, 2:23 PM
Laximan Vagare
Laximan Vagare - avatar