Only one test case gives wrong and the others are correct can u tell me why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Only one test case gives wrong and the others are correct can u tell me why?

n= int(input()) if n>=10: print ("High Five") elif n<1: print ("shh") elif n>1 and n<10: print (n*"Ra!")

23rd Sep 2021, 11:45 AM
Gehad Adel
6 Answers
+ 2
You should use a loop to print Ra, n*Ra doesn't work I think. Try it with using a loop and see what will happen. I hope, it helps. Happy coding!
23rd Sep 2021, 11:49 AM
mesarthim
mesarthim - avatar
+ 2
Gehad Adel "High Five" for greater than 10 not for 10. Remove '=' from line 2 and add it in 6th line like "elif n>1 and n<=10"
23rd Sep 2021, 12:13 PM
Azhagesanヾ(✿)
Azhagesanヾ(✿) - avatar
+ 2
Check your conditions : high five for over 10 not =, and for Ra! <= 10.
23rd Sep 2021, 12:13 PM
Angela
Angela - avatar
+ 2
Gehad Adel In your code the bounds are n>1 and n<10, but it must be, n>=1 and n<=10 also you should use a loop, then it must be okay! Try this! n= int(input()) if n>10: print ("High Five") elif n<1: print ("shh") elif n>=1 and n<=10: while n != 0: print("Ra!")
23rd Sep 2021, 12:14 PM
mesarthim
mesarthim - avatar
0
It doesn't work !
23rd Sep 2021, 12:01 PM
Gehad Adel
0
#Angela This the right answer thank u Thanks for all.
23rd Sep 2021, 12:24 PM
Gehad Adel