0

Cheer creator

n=int(input()) if n<1: print("shh!") for i in range(1,n+1): print("Ra!") if n>10: print ("High Five") What is the mistake in this

10th Apr 2020, 9:58 AM
Shijali Khare
5 Antworten
+ 1
your for loop must be in an if statement. if n<1: print('shh') elif n<=10: for i in range(n): print('Ra!', end='') else: print('High Five') the for loop can also be replaced by print('Ra!' *n)
10th Apr 2020, 10:20 AM
John Robotane
John Robotane - avatar
+ 3
Take help of this code... n=int(input("")) if n<1: print("shh") elif n>=1 and n<11: print("Ra!"*n) else: print("High Five") your for Loop runs every time...it should be inside elif
10th Apr 2020, 10:19 AM
ANJALI SAHU
+ 1
First, it's 'shh' not 'shh!' The for loop doesn't check any condition i.e if the input is 11 it prints both 'Ra' *11 and high five
10th Apr 2020, 10:20 AM
Justus
Justus - avatar
0
Try n=int(input()) If n in range(1,11): print("Ra!"*n)
10th Apr 2020, 10:21 AM
Justus
Justus - avatar
0
Thanks to all
10th Apr 2020, 10:26 AM
Shijali Khare