+ 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
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.'
+ 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.
+ 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. :)
+ 3
end='' missing.
Pro tip:
Test your code with handmade input of your own, then you'll find more quickly what the issue is!
+ 3
yards = int(input())
if yards < 1:
print("shh")
elif yards > 1 and yards <= 10:
print("Ra!" * yards)
else:
print("High Five")
+ 3
One number can never happen with your given conditions.
Can you figure out which one?
+ 3
Congrats! 🙂
+ 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
+ 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.
+ 2
Well done buddy.
Easy mistake, we have all done it.
+ 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.
+ 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 = '')
+ 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!
+ 1
Hi , I cleared all test cases using 'java'.
+ 1
Only High Five.
+ 1
HonFu is that 10??
+ 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
+ 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))
0
Your code works.
Can you describe your problem with it?
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.