+ 2
Skee-ball test case 3 python Code Coach
Hi there, Getting false for the third case. Checked here https://www.sololearn.com/discuss/2130536/?ref=app https://www.sololearn.com/discuss/2154724/?ref=app an nothing helped. Also tried the extreme case like 24, 2. and (code worked well on pycharm) this is my code: import math score = int(input()) price = int(input()) if score != 0: gained = (score / 12) tickets = math.floor(gained) else: print("Try again") if tickets >= price: print("Buy it!") else: print("Try again") please help
9 ответов
- 1
Just delete lines 1, 4-10, calculate instead of this in line 11. That's everything.
+ 2
If "score" is 0, "tickets" is never defined and you get a NameError.
+ 1
Thanks :)
0
You're getting much too complex for the task. It was not requested to round anything anyway.
0
And there's no need to exclude the zero from this calculation...
0
Ive tried adding
tickets = 0 before the first if statment, it didnt help, also when getting zero as score output will be Try again
0
Simple & stupid 😉👍
0
I am also getting error only for the third case.
My code:
score=int(input())
price=int(input ())
if (score//12)>price:
print('Buy it!)
else:
print(Try again')
It is locked and I can't see why does it gives me a wrong output
0
x=int(input())
y=int(input())
if ((x/12)>=y):
print("Buy it!")
else:
print("Try again")
It's simple and easy try copy pasting in exact same way.