So close but so far... Help? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

So close but so far... Help?

Brand new to python but I have been working on some of the easier coding challenges. I am so close to having this one beat for the Cheer Creator challenge but I fail on test 4. What am I missing? https://code.sololearn.com/cYWTjXUiNY1j/?ref=app

1st Jun 2020, 6:33 AM
Billy Collett
Billy Collett - avatar
9 Answers
0
whats the challenge
1st Jun 2020, 6:34 AM
durian
durian - avatar
0
You are cheering on your favorite team. After each play, if your team got over 10 yards further down the field, you stand up and give your friend a high five. If they don't move forward by at least a yard you stay quiet and say 'shh', and if they move forward 10 yards or less, you say 'Ra!' for every yard that they moved forward in that play. Task Given the number of yards that your team moved forward, output either 'High Five' (for over 10), 'shh' (for <1), or a string that has a 'Ra!' for every yard that they gained. Input Format An integer value that represents the number of yards gained or lost by your team. Output Format A string of the appropriate cheer. Sample Input 3 Sample Output Ra!Ra!Ra!
1st Jun 2020, 6:36 AM
Billy Collett
Billy Collett - avatar
0
Thank you both. Seems so obvious but it really had my head swirling.
1st Jun 2020, 6:40 AM
Billy Collett
Billy Collett - avatar
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 i think that should solve thr challenge
1st Jun 2020, 6:41 AM
durian
durian - avatar
0
im just saying u already solved the challenge
1st Jun 2020, 6:44 AM
durian
durian - avatar
0
Change your code to: yards= int(input()) i= yards if i < 1 : print("shh") elif i > 10 : print("High Five") else: print("Ra!"* i)
2nd Jun 2020, 4:26 AM
Bot
Bot - avatar
0
n = int(input()) if n>10: print('high five') elif n<1: print('shh') else: print('Ra!'*4)
2nd Jun 2020, 2:34 PM
Neeraj Sharma
Neeraj Sharma - avatar
2nd Jun 2020, 3:52 PM
Neeraj Sharma
Neeraj Sharma - avatar
0
The last line has to print("Ra!"*i) for Ra to be printed once for each yard (I)
2nd Jun 2020, 3:54 PM
Billy Collett
Billy Collett - avatar