Question: Fix this Code This code is not running properly because of a logic problem. No matter what value we put in for money, the ouput

Fix this Code
This code is not running properly because of a logic problem. No matter what value we put in for money, the ouput do
Re-write the if-elif-else statement so it executes properly. Use the value of 10 to match the output under Desire
Click Run to check your code. Click Submit to submit your code to your instructor.
Your Output:
candy =5
soda =5
popcorn =7
money = int(input("How much money do you have?"))
7. If money candy+soda+popcorn:
8 print ("You can buy all three.")
9. elif money candy+popcorn:
print("You can buy candy and popcorn")
elif money candy+soda:
print ("You can buy soda and candy")
elif money soda:
print("You can buy soda")
else:
print("You can't buy anything!")
 Fix this Code This code is not running properly because of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!