Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!")
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago