Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

product=0 number=0 total_price=0 total_amount=0 while(number!=4): number=int(input( Watchmen Security Supply 1. Add to Inventory 2. View Inventory 3. Product Report 4. Exit )) if(number==1): product=int(input( Enter

product=0 number=0 total_price=0 total_amount=0

while(number!=4): number=int(input(" Watchmen Security Supply 1. Add to Inventory 2. View Inventory 3. Product Report 4. Exit ")) if(number==1): product=int(input(" Enter number of product to add:")) for i in range(0,product): name=input(" Enter name:") price=int(input("Enter price:")) amount=int(input("Enter amount:")) item.append([name,price,amount]) if(number==2): print("Name\tPrice\tAmount ") for i in range(0,product): print(item[i][0],"\t",item[i][1],"\t",item[i][2]," ") if(number==3): for i in range(product): total_price += item[i][1]*item[i][2] total_amount += item[i][2] print(" Total price = ",total_price," Total Amount = ", total_amount)

output:

Watchmen Security Supply 1. Add to Inventory 2. View Inventory 3. Product Report 4. Exit 1 Enter number of product to add: 4 Enter name: q Enter price: 2 Enter amount: 3 Enter name: e Enter price: 4 Enter amount: 32 Enter name: q Enter price: 2 Enter amount: 3 Enter name: r Enter price: 1 Enter amount: 2 Watchmen Security Supply 1. Add to Inventory 2. View Inventory 3. Product Report 4. Exit 3 Total price = 6 Total Amount = 3 Total price = 134 Total Amount = 35 Total price = 140 Total Amount = 38 Total price = 142 Total Amount = 40

//can't figure out why I am getting total of every price and amount entered. I want it to only print the total price and total amount of all item entered.

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

1 2 8 .

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago

Question

LO4 Identify a system for controlling absenteeism.

Answered: 1 week ago

Question

LO2 Explain the nature of the psychological contract.

Answered: 1 week ago