Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Turn this code into an HTML file. # User is asked if they have enough money to purchase an item. name = input (

Turn this code into an HTML file. # User is asked if they have enough money to purchase an item.
name = input("Hello there! Please enter your name: ")
budget = input(f"Hi there, {name}! How much is your budget: ")
print(f"It looks like your budget is ${budget}. Is that correct {name}?")
Q1= input("Please enter Yes or No: ")
Jif Q1== 'Yes' or Q1== 'Yes' or Q1== 'YES':
item_cost = input("How much does the item that you plan to purchase cost? ")
# Function that is used to print out a message to the user stating they have enough funding.
def congrats_text():
print(f"Congratulations {name}! You have enough money to purchase your product!")
congrats_text()
# Function that is used to check if the user has a remaining balance after the purchase is completed.
def budget_analysis():
if budget > item_cost:
remaining = int(budget)- int(item_cost)
print(f"You will have ${remaining} leftover.")
elif budget == item_cost:
print("You may want to consider saving more money.")
budget_analysis()
else:
print(f"Please restart {name}.")
print ("Thank you!")
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

Students also viewed these Databases questions

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago