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...
4.10 Branching Practice 2 - Python Exercise #Write the code for the following #Exercise 1 #Ask...
4.10 Branching Practice 2 - Python Exercise #Write the code for the following #Exercise 1 #Ask the user to input a name using an input statement (no prompt) and assign it to a variable #Condition: user input is equal to 'Joseph' #Action: display the user input on screen #Exercise 2 #Ask the user to input his/her first name using an input statement (no prompt) and assign it to a variable #Condition: user input is equal to 'Joseph' #Action: display 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,...
COSC 1436 Programming Assignment : Skill Practice Assignment 3 Your skill practice assignment this week will...
COSC 1436 Programming Assignment : Skill Practice Assignment 3 Your skill practice assignment this week will be programming challenge #6 on page 374 - Kinetic Energy In it you are asked to write a programing that returns the amount of kinetic energy the object has. You will ask the user to enter values for mass and velocity. You will need to create a function named kinetic Energy that accepts an object's mass (in kilograms) and velocity (in meters per second)...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT