0

How do i fix the following code? My try is producing a 4/5 test cases fail

Lets 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 ilone ice-cream and will output the remaining only if you can buy that ice-cream for all your 10 friends. Sample input 80 70 Sample output Explanation 7*10=70. 10 is remaining money (80-70) Do not ouput anything iv the total is above 100. My try money=int(input()) price=int(input()) if price>100 print(money-price)

30th Aug 2020, 7:44 AM
Abraham Zimba
Abraham Zimba - avatar
2 Answers
0
Abraham Zimba , in my opinion you don't check anywhere in your code for the condition "only if you can buy that ice-cream for all your 10 friends". What if you have 80 in total money, and price is 100 of the ice-cream. I suggest to add in the if clause after price > 100 => "and money - price >= 0".
30th Aug 2020, 8:27 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Where is else part ????? Create it I think it may help you
30th Aug 2020, 9:11 AM
Ayush Kumar
Ayush Kumar - avatar