0

Can’t get #4 to work

Let's imagine you want to buy an ice-cream for 10 of your friends. Write a program that will take the money you have and the price of one ice-cream, and will output the remaining money only if you can buy that ice-cream for your all 10 friends. Sample Input 80 7 Sample Output 10 Explanation 7*10 = 70. 10 is remaining money (80-70). My code: money = int(input()) price = int(input()) all = price * 10 x = money - all if money <= 100 and money - all >= 0: print(x)

9th Aug 2020, 5:27 PM
Jon Desmond Faldmo
Jon Desmond Faldmo - avatar
4 ответов
+ 8
if x>=0: print(x)
9th Aug 2020, 5:31 PM
Julia Shabanova
Julia Shabanova - avatar
+ 1
thanks! I went back and named everything and now it make sense. money = int(input()) price = int(input()) total = price * 10 remainder = money - total if remainder >= 0: print(remainder)
9th Aug 2020, 6:09 PM
Jon Desmond Faldmo
Jon Desmond Faldmo - avatar
0
money = int(input()) price = int(input()) if price*10<=int(100): if (money//price) >= 10: if(money-price*10)>=0: print(money-price*10) ... Mine not work :(
8th Sep 2020, 5:43 PM
Nomes
Nomes - avatar
0
This works perfectly money = int(input()) price = int(input()) total = price*10 #your code goes here remainder= money-total if (total>100): print() else : print(remainder) #All task will complete
3rd Dec 2020, 6:25 AM
Abhishek Sinha
Abhishek Sinha - avatar