Please help me with this problem in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please help me with this problem in python

You are camping alone out in the jungle and you hear some animals in the dark nearby. Based on the noise they make, determine which animals they are. Task: You are given the noises made by different animals that you can hear in the dark, evaluate each noise to determine which animal it belongs to. Lions say 'Grr', Tigers say 'Rawr', Snakes say 'Ssss', and Birds say 'Chirp'. Input Format: A string that represent the noises that you hear with a space between them. Output Format: A string that includes each animal that you hear with a space after each one. (animals can repeat) Sample Input: Rawr Chirp Ssss Sample Output: Tiger Bird Snak

28th Mar 2020, 9:54 AM
Raza Alam
Raza Alam - avatar
18 Answers
+ 5
Kindly first show your attempt toward this problem than we help you in your code.
28th Mar 2020, 9:56 AM
Muhammad Bilal
Muhammad Bilal - avatar
+ 5
The best start and beginning is to go through the python tutorial. You also need to practice before you start to solve code challenges. And you can be sure, there is no shortcut or easy way to improve your knowledge in coding or whatever you are going to learn.
28th Mar 2020, 10:36 AM
Lothar
Lothar - avatar
+ 4
sounds={"Grr":"lion","Rawr":"tiger","Ssss":"snake","Chirp":"bird"} inputs="Grr Rawr Rawr Ssss Chirp" output="" for x in inputs.split(): output+=" "+sounds[x] print(output[1:]) Here you go.
28th Mar 2020, 5:13 PM
LoystonLive
LoystonLive - avatar
+ 3
Replace is the function which use to replace a separate word in a document or some thing. The code is go like this way. But also we can create two arrays and replace the words by for function. wo=input() print(wo.replace("Grr","Lion").replace("Ssss","Snake").replace("Rawr","Tiger").replace("Chirp","Bird"))
29th Mar 2020, 10:01 AM
Mahanama Gamage
Mahanama Gamage - avatar
+ 3
You should try to solve it, you actually have to take user input in a string format and then distribute the noises with the help of spaces given between them and then identify each noise and make output string having names of animals also separated by a gap.
29th Mar 2020, 3:29 PM
Samar Fatima
Samar Fatima - avatar
+ 2
U can also use replace function to replace sounds with animals
29th Mar 2020, 8:57 AM
Mahanama Gamage
Mahanama Gamage - avatar
+ 1
Thanks But it's something new i have to learn more about the functions
28th Mar 2020, 12:17 PM
Raza Alam
Raza Alam - avatar
+ 1
Muhammad Bilal Thanks to you i learn something new today
28th Mar 2020, 12:30 PM
Raza Alam
Raza Alam - avatar
0
I don't even know from where to star which tool i use
28th Mar 2020, 9:57 AM
Raza Alam
Raza Alam - avatar
0
I only want to that from where i start #a beginner
28th Mar 2020, 9:58 AM
Raza Alam
Raza Alam - avatar
0
Check this also python tutorial course on sololearn is helpful for you. https://www.sololearn.com/Discuss/2018656/?ref=app
28th Mar 2020, 10:02 AM
Muhammad Bilal
Muhammad Bilal - avatar
0
I solve 10 of them but struck in that
28th Mar 2020, 11:41 AM
Raza Alam
Raza Alam - avatar
0
That what i want to know how i start or which thing should i use
28th Mar 2020, 11:42 AM
Raza Alam
Raza Alam - avatar
0
Raza Alam This is my attempt might be helpful for you.kindly check it.. https://code.sololearn.com/c37bQkMqX5Nx/?ref=app
28th Mar 2020, 11:51 AM
Muhammad Bilal
Muhammad Bilal - avatar
0
You're welcome
28th Mar 2020, 12:40 PM
Muhammad Bilal
Muhammad Bilal - avatar
29th Mar 2020, 5:52 AM
कामेश
कामेश - avatar
0
Replace????? Can you please explain this
29th Mar 2020, 9:50 AM
Raza Alam
Raza Alam - avatar
0
Oh thanks
29th Mar 2020, 10:11 AM
Raza Alam
Raza Alam - avatar