Skee-ball test case 3 python Code Coach | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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

30th Jul 2020, 10:15 PM
FollowMe2020
FollowMe2020 - avatar
9 ответов
- 1
Just delete lines 1, 4-10, calculate instead of this in line 11. That's everything.
1st Aug 2020, 7:36 PM
Sandra Meyer
Sandra Meyer - avatar
+ 2
If "score" is 0, "tickets" is never defined and you get a NameError.
30th Jul 2020, 11:46 PM
Diego
Diego - avatar
+ 1
Thanks :)
1st Aug 2020, 7:49 PM
FollowMe2020
FollowMe2020 - avatar
0
You're getting much too complex for the task. It was not requested to round anything anyway.
30th Jul 2020, 11:16 PM
Sandra Meyer
Sandra Meyer - avatar
0
And there's no need to exclude the zero from this calculation...
31st Jul 2020, 12:39 AM
Sandra Meyer
Sandra Meyer - avatar
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
1st Aug 2020, 7:15 PM
FollowMe2020
FollowMe2020 - avatar
0
Simple & stupid 😉👍
1st Aug 2020, 7:51 PM
Sandra Meyer
Sandra Meyer - avatar
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
13th Nov 2021, 10:06 PM
Gi Gi
Gi Gi - avatar
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.
31st May 2022, 11:28 AM
Hrithika Reddy
Hrithika Reddy - avatar