+ 1

[CODE COACH] Cheer creator

Somebody help me out plz I just want to solve this problem by using basics of python only. My attempt: import math n=int(input()) m=math.fabs(n) if n>0: print("Ra!"*n) else: print("shh") but 1 it is not working for 1 test out of 5 tests https://www.sololearn.com/coach/20?ref=app

23rd Feb 2020, 4:48 PM
Suraj Das
Suraj Das - avatar
8 Antworten
+ 3
You are thinking too complicated. Just model step by step what the task tells you, you don't need to look for hacks. What if <1? What if in between? What if >10?
23rd Feb 2020, 7:12 PM
HonFu
HonFu - avatar
+ 2
The point of these problems is to train your problem-solving skill. Giving you the solution would destroy their purpose. Have you tried to do it on your own? Can you show us your attempt? We may give you a hint.
23rd Feb 2020, 5:53 PM
HonFu
HonFu - avatar
+ 2
Tysm HonFu I got this overthinking is bad ✌
23rd Feb 2020, 7:36 PM
Suraj Das
Suraj Das - avatar
+ 1
HonFu see I had tried code: import math n=int(input()) m=math.fabs(n) if n>0: print("Ra!"*n) else: print("shh") but 1 it is not working for 1 test out of 5 tests
23rd Feb 2020, 6:13 PM
Suraj Das
Suraj Das - avatar
+ 1
You are missing a complete case. What's with the condition for >10?
23rd Feb 2020, 6:54 PM
HonFu
HonFu - avatar
+ 1
25th Feb 2020, 10:14 PM
Suraj Das
Suraj Das - avatar
0
HonFu still not working... 🥵 n=int(input()) if n>0 and n<10: print("Ra!"*n) elif n%10==0: print("shh") elif n%10>0: print("Ra!"*(n%10)) else: print("shh")
23rd Feb 2020, 7:10 PM
Suraj Das
Suraj Das - avatar
0
def prob(move): if(move<1): print('shh') elif(move>10): print('High Five') else: n = 'Ra!'*move print(n) prob(int(input())) #All 5 test cases work with this code and is easy to understand
25th Feb 2020, 11:33 AM
Yashshree Patil
Yashshree Patil - avatar