+ 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..
17 ответов
+ 3
Demon Slayer I was created some mistakes you can check it now and repair your code
+ 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."
+ 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!
+ 3
money = int(input())
price = int(input())
total = price*10
if money>=total:
print(money-total)
This is the correct code...
+ 2
Demon Slayer try upper solution
+ 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.
+ 1
Demon Slayer check this now I have fixed alllll
No errors will occur
https://code.sololearn.com/c2T9q6L0sG2C/?ref=app
+ 1
money = int(input())
price = int(input())
cost = price * int(10)
if money>100:
print (!)
elif money >= cost:
print (money-cost)
Solutions
+ 1
Copy the code keep print () like this , don't use ("!")this and run pass all case
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
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
0
money = int(input())
price = int(input())
cost = price*int(10)
if money >= cost <= int(100):
print (money - cost)
ull thank me later
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)
0
@Cipher can please explain your code
- 1
What's the error? Can you share the code?
- 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)")
- 1
money = int(input())
price = int(input())
cost = price*int(10)
if money >= cost :
print (money - cost)
cleared all cases