Please explain | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 6

Please explain

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. Am getting error..

19th Aug 2020, 3:10 AM
Demon Slayer
Demon Slayer - avatar
17 Respuestas
+ 3
Demon Slayer I was created some mistakes you can check it now and repair your code
19th Aug 2020, 3:46 AM
Shubham Ingale
Shubham Ingale - avatar
+ 3
So there is mistake in the content of task, because this code doesn't included "Do not output anything if the total price is above 100."
18th Oct 2020, 9:41 AM
Monika PierzchaŇāa
Monika PierzchaŇāa - avatar
+ 3
THIS IS THE CODE YOU ARE LOOKING FOR! money= int(input()) price = int(input()) total = price*10 if money >= total <= 100: print(money-total) Please upvote if it worked for you!
10th Dec 2020, 1:21 AM
John Crafton
John Crafton - avatar
+ 3
money = int(input()) price = int(input()) total = price*10 if money>=total: print(money-total) This is the correct code...
2nd Aug 2021, 2:07 PM
Kevinorucai
+ 2
Demon Slayer try upper solution
19th Aug 2020, 3:24 AM
Shubham Ingale
Shubham Ingale - avatar
+ 2
This will be the correct one: // money = int(input()) price = int(input()) total = price*10 #your code goes here if money>=total: print(money-total) // Because IF you have more or equal money, than the total THEN print out your remaining money by substracting the total from all of your money.
29th Dec 2021, 1:16 PM
Barbócz Richárd
Barbócz Richárd - avatar
+ 1
Demon Slayer check this now I have fixed alllll No errors will occur https://code.sololearn.com/c2T9q6L0sG2C/?ref=app
19th Aug 2020, 3:44 AM
Shubham Ingale
Shubham Ingale - avatar
+ 1
money = int(input()) price = int(input()) cost = price * int(10) if money>100: print (!) elif money >= cost: print (money-cost) Solutions
8th Dec 2020, 2:30 PM
VHRT
VHRT - avatar
+ 1
Copy the code keep print () like this , don't use ("!")this and run pass all case
8th Dec 2020, 2:31 PM
VHRT
VHRT - avatar
0
money = int(input()) price = int(input()) all=price*10 x=money-all if all<=100: print(x) Am not able to pass all cases
19th Aug 2020, 3:36 AM
Demon Slayer
Demon Slayer - avatar
0
same problem here. im a pybton noob, but i feel like theres something wrong with this exercise. money = int(input()) price = int(input()) total = 10 * price remainder = money - total if remainder >= 0: if total <= 100: print(remainder) case 4 fails no matter what i try
15th Sep 2020, 2:16 AM
Chaz Smith
Chaz Smith - avatar
0
money = int(input()) price = int(input()) cost = price*int(10) if money >= cost <= int(100): print (money - cost) ull thank me later
18th Dec 2020, 10:07 AM
Srikanth Brahmajosyula
Srikanth Brahmajosyula - avatar
0
@Srikanth Brahmajosyula thanks for your input! There is only one problem, for test case #5, you must also satisfy the condition of money=151 and price=13 If not for that test case, your answer would work. Instead, users can try the following where <= int(100) is removed to prevent an error when money is greater than 100. money = int(input()) price = int(input()) total = price*10 if money >= total: print (money - total)
11th Jun 2021, 11:18 AM
Theo
Theo - avatar
0
@Cipher can please explain your code
14th Aug 2021, 7:29 AM
kaustubh mohite
kaustubh mohite - avatar
- 1
What's the error? Can you share the code?
19th Aug 2020, 3:18 AM
Steven M
Steven M - avatar
- 1
my_money = int(input ()) prize_ic=int(input ()) rm =prize_ic - my_money t= my_mony%10 to= str(rm) if t = 0 : print("paid money for 10 ice-creams = "+to else : print("Not purchased enough ICE-creams (min-10 ic have to purchase)")
19th Aug 2020, 3:20 AM
Shubham Ingale
Shubham Ingale - avatar
- 1
money = int(input()) price = int(input()) cost = price*int(10) if money >= cost : print (money - cost) cleared all cases
9th Oct 2020, 8:06 PM
Cipher
Cipher - avatar