0

Cheer Creator in Python.

Hey guys, I was attempting this easy question but seems like there is an error that I can't recognize. Thank you. Here is the question : https://www.sololearn.com/coach/20?ref=app And here is my code: yard=int(input()) if yard==10: print('High Five') elif yard>0 and yard<10: print(yard*'Ra!') else: print('shh')

27th May 2021, 1:42 PM
Prakhar
Prakhar - avatar
11 Respostas
+ 3
if(yard< 1): print("shh") elif yard> 10: print("High Five") else: print("Ra!"*yard, end='') #do like this
27th May 2021, 1:52 PM
Atul [Inactive]
+ 2
Prakhar Yes, Atul is right. Your condition is wrong. Check his code. Atul It looks just strange to use brackets in Python. But I know that is hard not to use them if you know Java. 😆
27th May 2021, 2:02 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Hello Prakhar Can you show us the question and your code?
27th May 2021, 1:47 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
if(yard<1) Print('shh') Else Print(yard*'Ra!') #do this
27th May 2021, 1:48 PM
Atul [Inactive]
+ 1
n=int(input()) i=1 if(n < 1): print("shh") elif n > 10: print("High Five") else: print("Ra!"*n, end='') i=i+1 # my code
27th May 2021, 1:59 PM
Atul [Inactive]
+ 1
Denise Roßberg hello sir Brackets are optional in python. It is advisable not to use them in python. But habituated with java. So you must be knowing
27th May 2021, 2:00 PM
Atul [Inactive]
0
Denise Roßberg Yeah I just edited the post 😅
27th May 2021, 1:49 PM
Prakhar
Prakhar - avatar
0
Atul There is also a condition for yards = 10.
27th May 2021, 1:51 PM
Prakhar
Prakhar - avatar
0
This is the reworked code Atul , yard=int(input()) if yard>=10: print('High Five') elif yard<1: print('shh') else: print('Ra!'*yard) Still shows one of the tests as wrong... 4/5 are correct tho.
27th May 2021, 1:56 PM
Prakhar
Prakhar - avatar
0
Atul Python is not Java. Remove the brackets. ;) Prakhar Your code looks not wrong. Let me check if there is an error or if Sololearn has conncection issues.
27th May 2021, 1:57 PM
Denise Roßberg
Denise Roßberg - avatar
0
Denise Roßberg Alright 👍
27th May 2021, 1:59 PM
Prakhar
Prakhar - avatar