Ice Cream for Everyone isn't working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Ice Cream for Everyone isn't working?

I can't seem to get my code for this practice question 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 To buy 10 ice-creams you need 7*10 = 70. The remaining money is 80-70 = 10. code: money = int(input()) price = int(input()) total = price*10 if money >= total Print() if money <= total print(money - total)

15th Feb 2021, 8:47 PM
Alita Tripp
Alita Tripp - avatar
6 Answers
0
What's total here ?
15th Feb 2021, 9:07 PM
Hima
Hima - avatar
0
your code is unclear write your inputs
15th Feb 2021, 9:15 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
0
Updated
15th Feb 2021, 11:20 PM
Alita Tripp
Alita Tripp - avatar
0
If you have enough money to buy the ice cream, you would buy it but in the code you are not .
15th Feb 2021, 11:29 PM
Hima
Hima - avatar
0
Is your question solved now, or I might help!!
16th Feb 2021, 2:04 AM
∆BH∆Y
∆BH∆Y - avatar
0
#Ice Cream for Everyone isn't working? #I can't seem to get my code for this practice question 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 #To buy 10 ice-creams you need 7*10 = 70. #The remaining money is 80-70 = 10. #code: #money = int(input()) #price = int(input()) #total = price*10 #if money >= total # Print() #if money <= total # print(money - total) money =int(80) price=int(7) total = price *10 print (total ,money -total) Can we try this
16th Feb 2021, 6:13 PM
Irfan Shaikh
Irfan Shaikh - avatar