Question

In: Computer Science

2.13 Program: Food receipt (Python 3) 1.Enter food item name: hot dog Enter item price: 2...

2.13 Program: Food receipt (Python 3)

1.Enter food item name: hot dog

Enter item price: 2

Enter item quantity: 5

RECEIPT

5 hot dog @ $ 2.0 = $ 10.0

Total cost: $ 10.0

2.Enter food item name: hot dog

Enter item price: 2

Enter item quantity: 5

RECEIPT

5 hot dog @ $ 2.0 = $ 10.0

Total cost: $ 10.0

Enter second food item name: ice cream

Enter item price: 2.50

Enter item quantity: 4

RECEIPT

5 hot dog @ $ 2.0 = $ 10.0

4 ice cream @ $ 2.5 = $ 10.0

Total cost: $ 20.0

3.Enter food item name: hot dog

Enter item price: 2

Enter item quantity: 5

RECEIPT

5 hot dog @ $ 2.0 = $ 10.0

Total cost: $ 10.0

Enter second food item name: ice cream

Enter item price: 2.50

Enter item quantity: 4

RECEIPT

5 hot dog @ $ 2.0 = $ 10.0

4 ice cream @ $ 2.5 = $ 10.0

Total cost: $ 20.0

15% gratuity: $ 3.0

Total with tip: $ 23.0

 

Solutions

Expert Solution

PLEASE GIVE THUMBS UP, THANKS

SAMPLE OUTPUT :

code:


@author: VISHAL
"""

item_name=list();
item_price=list();
item_quantity=list();
item_name.append(input("Enter food item name : "));
item_price.append(float(input("Enter item price : ")));
item_quantity.append(int(input("Enter item quntity : ")));
print("RECEIPT");
print(str(item_quantity[0])+" "+item_name[0]+" @ $"+str(item_price[0])+" = $"+str(item_quantity[0]*item_price[0]));
item_name.append(input("Enter Second food item name : "));
item_price.append(float(input("Enter item price : ")));
item_quantity.append(int(input("Enter item quntity : ")));
print("RECEIPT");
print(str(item_quantity[0])+" "+item_name[0]+" @ $"+str(item_price[0])+" = $"+str(item_quantity[0]*item_price[0]));
print(str(item_quantity[1])+" "+item_name[1]+" @ $"+str(item_price[1])+" = $"+str(item_quantity[1]*item_price[1]));
total=(item_quantity[0]*item_price[0])+(item_quantity[1]*item_price[1]);
print("Total cost : $"+str(total));
gratuity=total*.15;
print("15% gratuity : $"+str(gratuity));
print("Total with tip : $"+str(total+gratuity))


Related Solutions

Write a Python program that has the user enter their name.   Using the user's name calculate...
Write a Python program that has the user enter their name.   Using the user's name calculate the following: 1. How many letters are in the user's name? 2. Print the user's name in REVERSE both in capital letters and lowercase letters 3. Print the ASCII value for each letter of the user's name. 4. Print the SUM of all of the letters of the user's name (add each letter from #3)
Write a Python program that asks the user to enter a student's name and 8 numeric...
Write a Python program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name will be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name. Write the following functions in the program: calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student determine_grade -...
PYTHON Write a program that asks the user to enter a student's name and 8 numeric...
PYTHON Write a program that asks the user to enter a student's name and 8 numeric assignment scores (out of 100 for each assignment). The program should output the student's name, a letter grade for each assignment score, and a cumulative average for all the assignments. Please note, there are 12 students in the class so your program will need to be able to either accept data for 12 students or loop 12 times in order to process all the...
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]...
In IDLE - Python 3, do the following: 1. Create File --> New 2. Enter the...
In IDLE - Python 3, do the following: 1. Create File --> New 2. Enter the code below in the new file (you may omit the comments, I included them for explanation #Python Code Begin x = int(input("Enter a number: ")) y = int(input("Enter another number: ")) print ("Values before", "x:", x, "y:", y) #add code to swap variables here #you may not use Python libraries or built in swap functions #you must use only the operators you have learned...
using python 3 1. Two-line input: print a prompt (e.g Enter your first name) and then...
using python 3 1. Two-line input: print a prompt (e.g Enter your first name) and then assign the input to a variable print ("Enter your first name")# the word prompt is the message the user should see firstName = input() print (firstName)
I'm working on a to-do list program in Python 2. I'm trying to delete an item...
I'm working on a to-do list program in Python 2. I'm trying to delete an item from the list and I'm not sure what I'm missing to do that. I haven't been able to get it to delete by string or by index number. Also, I'm trying to get the menu to run again after the user completes the add/delete/etc options. Do I need to put menu() menu_option = int(input("Welcome to your To-Do List. Please choose and option to continue:...
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,...
In Python, write a program that allows the user to enter a number between 1-5 and...
In Python, write a program that allows the user to enter a number between 1-5 and returns the vitamins benefits based on what the user entered. The program should: Continue to run until the user quits and Validate the user’s input (the only acceptable input is 0, 1, 2, 3, 4, or 5), If the user enters zero “0” the program should terminate You can use the following facts: 1- Vitamin A protects eyes from night blindness and age-related decline...
In Python, write a program that allows the user to enter a number between 1-5 and...
In Python, write a program that allows the user to enter a number between 1-5 and returns the vitamins benefits based on what the user entered. The program should: Continue to run until the user quits and Validate the user’s input (the only acceptable input is 0, 1, 2, 3, 4, or 5), If the user enters zero “0” the program should terminate You can use the following facts: 1- Vitamin A protects eyes from night blindness and age-related decline...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT