+ 4

# Trying to solve ice cream for everyone in python core[solved]

Only two test cases seem to come out right money = int(input()) price = int(input()) total = price*10 d = total - money if total<=money: print() if total>=money: print(d) #your code goes here

2nd Apr 2021, 12:44 PM
Simisola Osinowo
+ 5
money = int(input()) price = int(input()) total = price*10 d = total - money if total<=money: print(d) else: print() #your code goes here
2nd Apr 2021, 1:39 PM
Simisola Osinowo
+ 4
Simba thanks
2nd Apr 2021, 1:44 PM
Simisola Osinowo
+ 4
May be first one
4th Apr 2021, 11:39 AM
Arushi
+ 3
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.
2nd Apr 2021, 1:20 PM
Simisola Osinowo
+ 3
2nd Apr 2021, 1:22 PM
Simisola Osinowo
+ 3
Jayakrishna🇮🇳 only two test case come out right The other is given negative value instead of positive value
2nd Apr 2021, 1:34 PM
Simisola Osinowo
2nd Apr 2021, 1:35 PM
Simisola Osinowo
+ 3
#Try this d = money - total
2nd Apr 2021, 1:40 PM
Simba
+ 3
Bob Blunk you solution is not pass all tests: money = int(input()) price = int(input()) total = price*10 if total >= money: print (total % money)
3rd Apr 2021, 1:20 PM
Yaroslav Vernigora
+ 3
money = int(input()) price = int(input()) total = price*10 if money >= total: print (money - total) How about this one?
3rd Apr 2021, 1:31 PM
Bob Blunk
+ 2
Pls post description also.. what this code is for? it output 'd' value if total == money is true. in any other case wont output anything. because 2nd if is inner to 1st if.
2nd Apr 2021, 12:52 PM
Jayakrishna 🇮🇳
+ 2
change <= on < end second if on elif or just use only second if because first if useless
2nd Apr 2021, 12:59 PM
Илья Мирошник
+ 2
I think: if price*10>=money print(money-total) Not <=
2nd Apr 2021, 1:27 PM
Yaroslav Vernigora
+ 2
2nd Apr 2021, 1:37 PM
Yaroslav Vernigora
+ 2
I didn't understand your logic a bit, but some values have a correct but negative value. use the output of the module abs()
2nd Apr 2021, 1:45 PM
Yaroslav Vernigora
+ 2
abs(d)
2nd Apr 2021, 1:47 PM
Yaroslav Vernigora
+ 2
For that sample if 7*10 <= 80 : print 80 - (7*10) = 10 It should works.. It said do nothing for else part.. but is it expecting something.. ? edit: Simisola Osinowo you are doing total-money but it should be money-total You don't need to put elss part.. remove it and try.... money = int(input()) price = int(input()) total = price*10 d = money - total if total<=money: print(d)
2nd Apr 2021, 2:27 PM
Jayakrishna 🇮🇳
+ 2
money = int(input()) price = int(input()) total = price*10 if money >= total: print (total % money) Or this one?
3rd Apr 2021, 1:32 PM
Bob Blunk
+ 2
I think both should work.
3rd Apr 2021, 1:32 PM
Bob Blunk
+ 2
First yes, second no 😉
3rd Apr 2021, 1:43 PM
Yaroslav Vernigora