+ 2

Cheer Creator

Hi guys I have a small problem with one of the tasks to do Please check my code: yards = int(input()) if yards >= 10: print("High five") elif yards <= 1: print("shh") else: for x in range(yards): print("Ra!", end="") I can't pass check 3 and 4. I am not able to swe what should be corrected as they are hiden

20th Dec 2019, 11:07 AM
Michał Kaczmarek
Michał Kaczmarek - avatar
28 Antworten
+ 11
Take another close look at the conditions as they're given in the 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.'
20th Dec 2019, 1:21 PM
HonFu
HonFu - avatar
+ 7
n=int(input()) if n<1: print("shh") elif n>1 and n<=10: print(n*"Ra!") elif n>10: print("High Five") TRY THE ABOVE CODE GUYS ITS WORKING.
26th Dec 2019, 11:37 AM
sai shankar
+ 5
Hello MoritzDa don't know if you still haven't solved the code or not, but I just intuitively and randomly changed 10 to 100 and now all cases were solved! So try this. :)
5th Feb 2020, 4:12 PM
Elisaveta
Elisaveta - avatar
+ 3
end='' missing. Pro tip: Test your code with handmade input of your own, then you'll find more quickly what the issue is!
20th Dec 2019, 8:31 PM
HonFu
HonFu - avatar
+ 3
yards = int(input()) if yards < 1: print("shh") elif yards > 1 and yards <= 10: print("Ra!" * yards) else: print("High Five")
10th May 2020, 8:30 PM
John McCormack
John McCormack - avatar
+ 3
One number can never happen with your given conditions. Can you figure out which one?
10th Jun 2020, 6:35 PM
HonFu
HonFu - avatar
+ 3
Congrats! 🙂
10th Jun 2020, 6:38 PM
HonFu
HonFu - avatar
+ 2
Ok, I am really confused now. I have checked your code with: input > 10, output 'High five' - ok Input < 1, output 'shh' - ok Input 3, output 'ra!ra!ra! - ok What do you want it to do? Or what do you mean by check 3 and check 4. I must be misunderstanding something
20th Dec 2019, 11:27 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Hi guys. I solved my case. I don't know why, but in my code I have added equal or higher/lower. There should'nt be equal.
23rd Dec 2019, 10:12 AM
Michał Kaczmarek
Michał Kaczmarek - avatar
+ 2
Well done buddy. Easy mistake, we have all done it.
23rd Dec 2019, 10:16 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
So now you have to figure out what to do with 10 as input. Try to read the description again, it's in there.
10th Jun 2020, 6:36 PM
HonFu
HonFu - avatar
+ 1
Thanks, but still can't pass test °3( yards = int(input('')) if yards > 10: print('High Five') if yards < 1: print('shh') else: print("Ra!" * yards, end = '')
20th Dec 2019, 8:42 PM
Георгий Шахов
Георгий Шахов - avatar
+ 1
Okay, please, do this: Actually run your code in Code Playground and make a few inputs. Come back and report after. I'm confident you'll find the mistake in no time!
20th Dec 2019, 8:44 PM
HonFu
HonFu - avatar
+ 1
Hi , I cleared all test cases using 'java'.
31st Dec 2019, 2:34 PM
Ajith
Ajith - avatar
+ 1
Only High Five.
10th Jun 2020, 6:30 PM
HonFu
HonFu - avatar
+ 1
HonFu is that 10??
10th Jun 2020, 6:35 PM
Taran Grover
Taran Grover - avatar
+ 1
HonFu i got that I tried to print high five uf it is 10 after commenting here, Now i just got my mistake thanks a lot
10th Jun 2020, 6:38 PM
Taran Grover
Taran Grover - avatar
+ 1
Test 3 doesnt pass, would you know what the issue is yards = float(input()) if yards > 10: print ("Hi Five") elif yards <= 1: print ("shh") else: print("Ra!"*int(yards))
3rd Jun 2022, 11:01 AM
Louis
0
Your code works. Can you describe your problem with it?
20th Dec 2019, 11:16 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
In code coach I am trying to resovle given task: "Cheer Creator" I am running my code there and in results I can see not all of the test cases are solved.
20th Dec 2019, 11:37 AM
Michał Kaczmarek
Michał Kaczmarek - avatar