+ 2
Skeeball challenge (Python)
https://sololearn.com/coach/21/?ref=app Because I canât get a hold of the test cases, I donât know whatâs wrong with the solution. I have tried these 2 solutions, and gives me error in the number 3. I have the suspicion is about rounding up or down the number, but I have tested outside SoloLearn (pycharm) and looks correct. CODE (Two solutions.): #1 points = int(input('How many points did you score?: ')) tickets = int(points / 12) if tickets >= 40: print('Buy it') else: print('Try again') ***** #2 import math points = int(input()) tickets = tickets = (math.ceil(points / 12)) if tickets >= 40: print('Buy it!') else: print('Try again') ****
2 Answers
+ 1
You don't seem to be taking the second input, and instead you're using the constant 40 for calculations. If that's not the issue, then what should work for you would be to do integer division.
points = int(input())
if points//12 >= 40:
and yeah, I just tried your first example, and the only reason case 3 is failing is because you did not take the second input. Your code works fine otherwise.
0
Thanks, Hatsy. That was the issue!