- 2
Why is test case 2 not pressing?
3 Réponses
+ 2
(1) Based on the problem, 12 points is 1 ticket, so here instead of comparing it to 12, use and divide the costs by 12 using floor division or //
(2) You have to compare it to the price of the gun.
Just an additional:
You can use " else " instead if you only have 1 comparison or if your "if" is not nested.
- - - - - - - - - - - - - - - - -
points = int(input())
costs = int(input())
if costs // 12 >= gun:
print('Buy it!')
else:
print('Try again')
+ 1
Motuncoded you have not added closing parentheses in the second block.
You should write it as this:
if points/costs> 12:
print ("Buy it!")
else:
print ("Try again)
- 1
points = int(input())
costs = int(input())
if points/costs>12:
print('Buy it!')
if points/costs<=12:
print('Try again'