+ 1

I got a bug, all the test cases are satisfied except the 3rd one which is hidden, please help me out.

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! # My try yards = int(input()) if ((yards == 10) and (yards > 10)): print("High five") elif ((yards == 1) or (yards < 1)): print("shh") elif ((yards == 10) or (yards < 10)): print(yards*"Ra!")

25th Jul 2021, 3:33 PM
Falguni Raja
Falguni Raja - avatar
8 Respuestas
+ 7
Hi Five is for more than 10. Shh is for less than 1. Ra is for the rest. By the way, you don't need any of those parentheses in your if/elif statements. yards = int(input()) if yards > 10: print("High Five") elif yards < 1: print("shh") else: print(yards * "Ra!") Your code would have failed if the hidden test was either yards = 10 or yards = 1.
25th Jul 2021, 4:02 PM
David Ashton
David Ashton - avatar
+ 2
Falguni Read problem again For over 10 print "High five" so there should be (yards > 10) only.
25th Jul 2021, 3:35 PM
A͢J
A͢J - avatar
+ 2
Falguni Also there is Caps F in five yards = int(input()) if (yards > 10): print("High Five") elif ((yards == 1) or (yards < 1)): print("shh") elif ((yards == 10) or (yards < 10)): print(yards*"Ra!")
25th Jul 2021, 3:39 PM
A͢J
A͢J - avatar
+ 1
Falguni Check my answer again.
25th Jul 2021, 3:41 PM
A͢J
A͢J - avatar
+ 1
A͢J Ya, Thankyou it was because of one small mistake caps f .., now it is done.
25th Jul 2021, 3:42 PM
Falguni Raja
Falguni Raja - avatar
+ 1
Falguni One more thing just for information. If yards is equal to 10 then it cannot be greater than 10. So your 1st condition was wrong.
25th Jul 2021, 3:45 PM
A͢J
A͢J - avatar
+ 1
David Ashton Ya, Thanks
26th Jul 2021, 9:08 AM
Falguni Raja
Falguni Raja - avatar
0
A͢J Thanks for your comment but I tried in this way also then too it isn't satisfying the condition
25th Jul 2021, 3:40 PM
Falguni Raja
Falguni Raja - avatar