+ 1

Can someone help me to find the mistake in my code?

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! And my code yards=int(input()) if yards >10: print('High Five'*(yards)) if yards <1: print('shh') else: print('Ra!'*(yards)) I've passed 4 out of 5

12th Jul 2021, 11:57 AM
Mei San
Mei San - avatar
4 Answers
+ 7
Also, You need to change your 2nd if statement to elif. Because, if your first if condition is false the program goes to else statement. So, there is no statement to check for yards <1. print('High Five') elif yards <1:
12th Jul 2021, 12:51 PM
Simba
Simba - avatar
+ 2
Mei San "High Five" should be print only one time
12th Jul 2021, 12:00 PM
A͢J
A͢J - avatar
+ 1
Mei San No that is not like that read description again.
12th Jul 2021, 12:15 PM
A͢J
A͢J - avatar
0
I ᴀᴍ "Tɪᴍᴇ" If your team gains 3 yards you would cheer 'Ra!' three times for that play. Same goes for 'High Five'
12th Jul 2021, 12:11 PM
Mei San
Mei San - avatar