Test case 4 don't work | SoloLearn: Learn to code for FREE!

0

Test case 4 don't work

Can't get the test 4 working?? https://www.sololearn.com/coach/127?ref=app money = int(input()) price = int(input()) all = price * 10 x = money - all if all <= 100: print(x) if Statements +10 XP 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 7*10 = 70. 10 is remaining money (80-70).

8/2/2020 10:38:27 AM

Kierren Haggerty

11 Answers

New Answer

+3

#This will work money = int(input()) price = int(input()) #your code goes here all = price * 10 bal = money - all if all > money : print() elif all <= 100: print (bal) elif price >= 0: print(bal)

+2

Kierren Haggerty , please place the whole description of the task, because it is visible only by Pro users, so somebody can help you.

+2

if Statements +10 XP 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 7*10 = 70. 10 is remaining money (80-70).

+2

Just check your if condition again.. It is in reverse...

+1

Thanks heaps

+1

money = int(input()) price = int(input()) total=price*10 #your code goes here remainder=money-total if (total>money): print() else: print(remainder) Despite all my attempt, I failed in test 4. Don't know how to resolve?

0

Kierren Haggerty , I think it should be if x >= 0: ....

0

“”” this worked for me “”” a = money = int(input()) b = price = int(input()) c = total_price = b * 10 d = balance = a - c e = a//b if c <= 100: print(d) elif e >= 10: print(balance) else: print()

0

this will definitely work money = int(input()) price = int(input()) total = price*10 left = money - total if (total > money): print() else : print(left) my all test cases passed

0

you need to do the print() to return nothing. if you simply skip if its bigger than 100, it’ll pass that test but fail test4

0

I think this is the shortest solution, money = int(input()) price = int(input()) total = price*10 if money >= total: print(money % total)