0
Problem with the Skee-Ball challenge
My code doesn't pass test 3 and I don't see a possible problem. I count how many tickets I get out of my points and then I count how many prizes it buys me. If it's more than one, I print the required string. Please help. https://code.sololearn.com/cQJNku0OVZWx/?ref=app https://www.sololearn.com/coach/21?ref=app
11 Respostas
0
I think that in 3rd test case price of the gun is 0. So ur code is giving divide by zero error.
+ 3
Take help from these post
https://www.sololearn.com/discuss/2130536/?ref=app
https://www.sololearn.com/discuss/2154724/?ref=app
+ 1
Damn you're right, thanks.
0
Pavel I used / in my code (instead of //)
0
I used // because I don't care about what's left after the division. I can try it, but if it works, I still won't know why.
0
Update: I used / with the same result.
0
Pavel I could imagine that it has to do with precision.
This is should work:
if points / 12 >= price:
0
Hari Shankar Good thought! I guess you could be right.
0
Hari Shankar I controlled for the division by zero and it works now. You can see the code under the original link. Thank you.
0
print({True : "Buy it!", False: "Try again"}[int(input(" "))/12 >= int(input(" "))])
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.