- 2

Why is test case 2 not pressing?

13th Jan 2021, 1:14 PM
Motuncoded
Motuncoded - avatar
3 Respuestas
+ 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')
13th Jan 2021, 1:25 PM
noteve
noteve - avatar
+ 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)
13th Jan 2021, 1:27 PM
CHANDAN ROY
CHANDAN ROY - avatar
- 1
points = int(input()) costs = int(input()) if points/costs>12: print('Buy it!') if points/costs<=12: print('Try again'
13th Jan 2021, 1:14 PM
Motuncoded
Motuncoded - avatar