Question

In: Computer Science

A customer comes into a grocery store and buys 8 items. Write a PYTHON program that...

A customer comes into a grocery store and buys 8 items. Write a PYTHON program that asks for the name of the item and the price of each item, and then displays these on the screen. Refer to the print() and input() statements covered in the module. Do NOT use loops as it will be covered in later modules. Apples 2.10 Hamburger 3.25 Milk 3.49 Sugar 1.99 Bread 1.76 Deli Turkey 7.99 Pickles 3.42 Butter 2.79

Solutions

Expert Solution

Python code:

#asking for item name
item1=input("Enter item name: ")
#asking for price
price1=input("Enter price: ")
#asking for item name
item2=input("Enter item name: ")
#asking for price
price2=input("Enter price: ")
#asking for item name
item3=input("Enter item name: ")
#asking for price
price3=input("Enter price: ")
#asking for item name
item4=input("Enter item name: ")
#asking for price
price4=input("Enter price: ")
#asking for item name
item5=input("Enter item name: ")
#asking for price
price5=input("Enter price: ")
#asking for item name
item6=input("Enter item name: ")
#asking for price
price6=input("Enter price: ")
#asking for item name
item7=input("Enter item name: ")
#asking for price
price7=input("Enter price: ")
#asking for item name
item8=input("Enter item name: ")
#asking for price
price8=input("Enter price: ")
#printing item name and price it item 1
print(item1+" "+price1)
#printing item name and price it item 2
print(item2+" "+price2)
#printing item name and price it item 3
print(item3+" "+price3)
#printing item name and price it item 4
print(item4+" "+price4)
#printing item name and price it item 5
print(item5+" "+price5)
#printing item name and price it item 6
print(item6+" "+price6)
#printing item name and price it item 7
print(item7+" "+price7)
#printing item name and price it item 8
print(item8+" "+price8)

Screenshot:


Input and Output:


Related Solutions

A customer comes into a grocery store and buys 8 items.   Write a PYTHON program that...
A customer comes into a grocery store and buys 8 items.   Write a PYTHON program that prompts the user for the name of the item AND the price of each item, and then simply displays whatever the user typed in on the screen nicely formatted.
Python: Write a program to simulate the purchases in a grocery store. A customer may buy...
Python: Write a program to simulate the purchases in a grocery store. A customer may buy any number of items. So, you should use a while loop. Your program should read an item first and then read the price until you enter a terminal value (‘done’) to end the loop. You should add all the prices inside the loop. Add then a sales tax of 8.75% to the total price. Print a receipt to indicate all the details of the...
A customer in a grocery store is purchasing three items. Write the pseudo code that will:...
A customer in a grocery store is purchasing three items. Write the pseudo code that will: • Ask the user to enter the name of the first item purchased. Then ask the user to enter the cost of the first item purchased. Make your program user friendly. If the user says the first item purchased is milk, then ask: “What is the cost of milk.” [This should work no matter what item is entered by the user. I might buy...
Grocery List Program Write a program that keeps track of the user's grocery list items. Prompt...
Grocery List Program Write a program that keeps track of the user's grocery list items. Prompt the user if they'd like to (each action is a function): See the list Display all items (if any) in the list Add item to their list Confirm with the user before adding item (y/n or yes/no) If they enter a duplicate item, notify them the item already exists Remove items from their list Confirm with the user before removing item (y/n or yes/no)...
Create a Python 3 program that acts as a grocery store shopping cart. 1. Create a...
Create a Python 3 program that acts as a grocery store shopping cart. 1. Create a class named GroceryItem. This class should contain: - an __init__ method that initializes the item’s name and price - a get_name method that returns the item’s name - a get_price method that returns the item’s price - a __str__ method that returns a string representation of that GroceryItem - an unimplemented method is_perishable Save this class in GroceryItem.py. 2. Create a subclass Perishable that...
IN PYTHON: Write a program to study countries and their capitals. The program will store country:capital...
IN PYTHON: Write a program to study countries and their capitals. The program will store country:capital information and allow the user to quiz themselves. These two functions are required for this assignment. You may add other functions that you deem appropriate: - menu()   This function, which displays all the user options to the screen, prompts the user for their choice and returns their choice. This function will verify user input and ALWAYS return a valid choice. - addCapital(dict) This function...
Develop a python program that will determine if a department store customer has exceeded the credit...
Develop a python program that will determine if a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:  Account number  Balance at the beginning of the month  Total of all items charged by this customer this month  Total of all credits applied to this customer’s account this month  Allowed credit limit The program should input each of the facts, calculate the new balance (=beginning...
Develop a python program that will determine if a department store customer has exceeded the credit...
Develop a python program that will determine if a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:  Account number, Balance at the beginning of the month, Total of all items charged by this customer this month, Total of all credits applied to this customer’s account this month and Allowed credit limit. The program should input each of the facts, calculate the new balance (=beginning balance + charges – credits),...
A customer in a store is purchasing two items. Design a program using module pseudocode that...
A customer in a store is purchasing two items. Design a program using module pseudocode that asks for the price of each item in dollars, and then displays three things in their output receipt - the subtotal of the sale in dollars, the amount of sales tax in dollars and the final amount paid by the customer in dollars. Assume the sales tax is 4 percent.
Calculate your Customer Lifetime Value (CLTV) as a grocery customer. How should a grocery store segment...
Calculate your Customer Lifetime Value (CLTV) as a grocery customer. How should a grocery store segment its market? Why? Create personas for each market segment the store should have.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT