+ 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
19 Answers
+ 5
Kindly first show your attempt toward this problem than we help you in your code.
+ 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.
+ 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.
+ 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"))
+ 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.
+ 2
U can also use replace function to replace sounds with animals
+ 1
Thanks
But it's something new i have to learn more about the functions
+ 1
Muhammad Bilal
Thanks to you i learn something new today
0
I don't even know from where to star which tool i use
0
I only want to that from where i start #a beginner
0
Check this also python tutorial course on sololearn is helpful for you.
https://www.sololearn.com/Discuss/2018656/?ref=app
0
I solve 10 of them but struck in that
0
That what i want to know how i start or which thing should i use
0
Raza Alam
This is my attempt might be helpful for you.kindly check it..
https://code.sololearn.com/c37bQkMqX5Nx/?ref=app
0
You're welcome
0
Replace????? Can you please explain this
0
Oh thanks