Question

In: Computer Science

Python Programming- 9.12 S80 MT Practice 2 """ Enhance your simple food receipt a. Ask the...

Python Programming- 9.12 S80 MT Practice 2

"""
Enhance your simple food receipt
a. Ask the user for inputs about two food items using the following prompts in turn [add a space after each
question mark]. Do not forget to assign each user
entry to a unique variable name (do not display the Note to add a space just use print() to add a space between each
set of input statements):
Name 1? [add a space after the question mark]
Price 1? [add a space after the question mark]
Quantity 1? [add a space after the question mark]
[Note: add space here using print()]
Name 2? [add a space after the question mark]
Price 2? [add a space after the question mark]
Quantity 2? [add a space after the question mark]
[Note: add space here using print()]
Name 3? [add a space after the question mark]
Price 3? [add a space after the question mark]
Quantity 3? [add a space after the question mark]
[Note: add space here using print()]
b. Convert the price and quantity variables to floats
c. Calculate the total cost for the order by calculating each item's total price by
multiplying price and quantity for each item and then adding up the total prices for the three items
d. Calculate the total cost plus tax for the order by multiplying the total cose calculated in c by the tax
rate of .0545 (5.45 percent tax) then adding the tax to the total cost
e. Display the results using the structure below. Edit the format string "${:,.2f}".format(identfier) to format the
results of your calculation as currency with the NTD currency type, a space between NTD and the calculated costs,
and 3 decimal places:
Summary of Charges
You ordered: [Item Name 1] [Item Name 2] [Item Name 3]
Your cost: [total price for all items calculated in 3c above, formatted with NTD currency, a space & 3 decimal places]
Your cost w tax: [total cost plus tax calculated in 3d above, formatted with NTD currency, a space & 3 decimal places]

"""
#Start your code below

Solutions

Expert Solution

Code:

n1 = input("Name 1? ")
q1 = input("Quantity 1? ")
p1 = input("Price 1? ")
print()
n2 = input("Name 2? ")
q2 = input("Quantity 2? ")
p2 = input("Price 2? ")
print()
n3 = input("Name 3? ")
q3 = input("Quantity 3? ")
p3 = input("Price 3? ")
print()
q1 = float(q1)
p1 = float(p1)
q2 = float(q2)
p2 = float(p2)
q3 = float(q3)
p3 = float(p3)
amount = p1*q1 + p2*q2 + p3*q3
total = amount + (amount * 0.0545)
print("You Ordered: %s %s %s" % (n1, n2, n3))
print("Your Cost:${:,.2f}".format(amount))
print("Your Cost w tax:${:,.2f}".format(total))

Output:


Related Solutions

Python Programming- 9.10 MT Practice Simple Food Receipt 2B """ Enhance your simple food receipt a....
Python Programming- 9.10 MT Practice Simple Food Receipt 2B """ Enhance your simple food receipt a. Ask the user for inputs about two food items using the following prompts in turn [add a space after each question mark]. Do not forget to assign each user entry to a unique variable name (do not display the Note to add a space just use print() to add a space between each set of input statements): Item 1? [add a space after the...
Python Programming- 9.11 S80 MT Practice1 #This is a template for practicing mutability and conversion #Create...
Python Programming- 9.11 S80 MT Practice1 #This is a template for practicing mutability and conversion #Create and assign the following list of numbers to a list data type and variable name: 88.5, 90, 75, 70, 85.6 #convert the list to a tuple and assign the tuple a different variable name #Ask the user for a grade and convert it to a float type (no prompt) and assign it to a new variable name #append the user entered grade to the...
Python Programming Write a simple implementation of a card deck to deal cards out randomly. Your...
Python Programming Write a simple implementation of a card deck to deal cards out randomly. Your Deck class will contain a list of card objects. Initially, the deck will contain one instance of each of the 52 possible cards. Your deck should implement a deal() method that chooses a random location from the list and "pops" that card. You should also implement a cardsLeft method that tells how many cards are left in the deck. Please type code and include...
Python Programming- Practice Lists & Tuples B #This is a template for practicing mutability and conversion...
Python Programming- Practice Lists & Tuples B #This is a template for practicing mutability and conversion #Create and assign the following list of numbers to a list data type and variable name: 99.9,88.7,89,90,100 #convert the list to a tuple and assign the tuple a different variable name #Ask the user for a grade and convert it to a float type (no prompt) and assign it to a new variable name #append the user entered grade to the list #update the...
You want to write a simple python program for a food delivery company that asks the...
You want to write a simple python program for a food delivery company that asks the office worker how many drivers they require to deliver their packages to different parts of town. When the user enters the number of drivers, the program will ask how many packages each driver will carry to its destination. It will then calculate the total number of packages and display the result on the screen as below. Sample run: How many drivers do you need?...
Python Programming Please! #Name: #Date: #Random number, loop while true #ask user for number. Check to...
Python Programming Please! #Name: #Date: #Random number, loop while true #ask user for number. Check to see if the value is a number between 1 and 10 #if number is too high or too low, tell user, if they guessed it break out of loop Display "Welcome to my Guess the number program!" random mynumber count=1 while True try Display "Guess a number between 1 and 10"   Get guess while guess<1 or guess>10 Display "Guess a number between 1 and...
In your python program, ask the user to enter the annual income of an employee and...
In your python program, ask the user to enter the annual income of an employee and the years of experience. Pass these data to a function. The function decides if an employee does qualify for a loan or does not, then it prints a message based on the following rules: If the income is equal or greater than $40000, the function checks if the employee’s years of experience is greater than 4, if so the employee gets $6000 loan; otherwise,...
Explain event-driven programming in Python. Give 2 examples of code where event-driven programming is used.
Explain event-driven programming in Python. Give 2 examples of code where event-driven programming is used.
Prompt: This exercise uses your programming environment to enhance the Web site you created last week...
Prompt: This exercise uses your programming environment to enhance the Web site you created last week with additional functionality to include images, tables and a Form using Python flask. Specifically, you will add two (2) additional routes allowing a user to register and login to a web site. Additional security considerations include other routes (beyond the register route) will not be accessible until a successful login has occurred. In addition to the requirements list above the following functionality should be...
PYTHON Part 2 (separate program) Ask for a file name. Don’t let the program crash if...
PYTHON Part 2 (separate program) Ask for a file name. Don’t let the program crash if you enter the name of a file that does not exist. Detecting this will also be discussed on Wednesday. If the file doesn’t exist gracefully display an error message stating the file doesn’t exist and quit the program. It the file does exist read all the values in the file. You will only need to read the file once, or more to the point,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT