Question: PYTHON How do I execute the following? thanks (1) A list called product is created and initialized. It consists of an item number, an item

PYTHON

How do I execute the following? thanks

(1) A list called product is created and initialized. It consists of an item number, an item name and a price. Add code to print the product information as a list. No input needed for this question.

Output:

['123','bread', 4.15] 

(2) Add code to print the product information on one line. The output should be formatted such that the value above prints as shown below. Do not use blank space between values, use tab instead . The print statement should not contain literals but it should refer to the list values. . No input for this question.

Output:

['123', 'bread', 4.15] 123 bread $4.15 

(3) Add code to perform the following:

Assign to the list product the values for a new item (i.e., item ID, item name, and item price). The values should come from user input.

Print the product information as a list.

The input:

453 milk 3.25 

gives the output:

['123', 'bread', 4.15] 123 bread $4.15 Enter the product ID: Enter the product name: Enter the product price: ['453', 'milk', 3.25] 

(4) Update code to append a whole number to the end of the list product. This number is obtained by user input. This number is the number of items purchased. Print the list product, then compute the total price of the item bought and print the result.

The input:

453 milk 3.25 5 

gives the output:

['123', 'bread', 4.15] 123 bread $4.15 Enter the product ID: Enter the product name: Enter the product price: ['453', 'milk', 3.25] Enter number of items purchased: ['453', 'milk', 3.25, 5] Total price: $16.25 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To address the given problem well write a Python script that executes each specified task stepbystep This exercise will give us experience working wit... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!