Question

In: Computer Science

Programming Activity 1(Python) Utilise a count-based iteration structure that will accepts the data listed below and...

Programming Activity 1(Python)

Utilise a count-based iteration structure that will accepts the data listed below and produce the total purchase amount. Your final report should be similar to the one show below.

Input Data:

Item Description Item Price
Salomon Fish $ 26.97
Ribeye Steak $ 12.98
Sweet Corn $ 4.96
Asparagus $5.92

Output:

Item Description Item Price

=================================

Salomon Fish $26.97

Ribeye Steak $ 12.98

Sweet Corn $ 4.96

Asparagus $ 5.92

Your total purchase: $ xx.xx

Solutions

Expert Solution

If you have any doubts, please give me comment...

Code:

item_descs = []

item_prices = []

desc = input("Enter item description(press Enter to exit): ")

total_price = 0

while desc != "":

price = float(input("Enter item price: "))

item_descs.append(desc)

item_prices.append(price)

total_price += price

desc = input("Enter item description(press Enter to exit): ")

print("\n%-15s %s"%("Item Description", "Item Price"))

print("==============================")

for it in range(len(item_descs)):

print("%-15s $ %5.2f"%(item_descs[it], item_prices[it]))

print("Your total purchase: $ %.2f"%total_price)


Related Solutions

Read chapter 3 from our text, Murach's Python Programming, focusing on coding the iteration structure (while...
Read chapter 3 from our text, Murach's Python Programming, focusing on coding the iteration structure (while statement). Then code Python statements for the pseudocode under a "Payment Schedule" shown below. Save these Python statements in a text file named with your first name, last name, the digits 06, and extension .py (e.g. joelMurach06.py). To maximize points earned, first test this file with Python IDLE to ensure it is error free, then attach the python file to an email sent to...
Activity rates from Quattrone Corporation's activity-based costing system are listed below. The company uses the activity...
Activity rates from Quattrone Corporation's activity-based costing system are listed below. The company uses the activity rates to assign overhead costs to products:   Activity Cost Pools Activity Rate   Processing customer orders $95.88 per customer order   Assembling products $2.76 per assembly hour   Setting up batches $53.30 per batch Last year, Product F76D involved 3 customer orders, 496 assembly hours, and 27 batches. How much overhead cost would be assigned to Product F76D using the activity-based costing system? Multiple Choice $1,439.10 $3,095.70...
Write a program in python programming language to implement/simulate a finite automaton that accepts (only): odd...
Write a program in python programming language to implement/simulate a finite automaton that accepts (only): odd Binary numbers // 00000000, 0101, 111111, etc. Show: Finite Automaton Definition, Graph, Table
Write a program in python programming language to implement/simulate a finite automaton that accepts (only): unsigned...
Write a program in python programming language to implement/simulate a finite automaton that accepts (only): unsigned integer numbers // 123, 007, 4567890, etc. Show: Finite Automaton Definition, Graph, Table.
Programming Activity 7 - Guidance ================================= This assignment uses a built-in Python dictionary. It does not...
Programming Activity 7 - Guidance ================================= This assignment uses a built-in Python dictionary. It does not use a dictionary implementation from the textbook collections framework. It does not require any imports/files from the textbook collections framework. This week's "examplePythonDictionary.py" example uses a built-in Python dictionary. Note that the mode() function begins by creating an empty Python dictionary. You must use this dictionary in the following parts. Part 1 ------ In this part you will add entries to the dictionary. Use...
Python programming: Instructions: The python program should respond to user input on a command line Below...
Python programming: Instructions: The python program should respond to user input on a command line Below are the four options - if the user input is A, the program will quit -if the user input is B, the program will display the number of times the prompt has been displayed -if the user input is C, will display whatever is stored. -if the user inputs something else, it will store that user input as a string and append it to...
Activity 2 Record your data from Activity 1 in the boxes below. Place the data (turbidity...
Activity 2 Record your data from Activity 1 in the boxes below. Place the data (turbidity value, appearance) for the samples in the appropriate columns (clean standard,           maximum load, standard, sample 1, sample 2, sample 3) The following information will be needed to make your conclusion -- In the region of the United States you are investigating, the allowable standards of turbidity are: Drinking water is 0.3 NTU Water for irrigation and industrial use 5 NTU Water released into...
Solve using PYTHON PROGRAMMING Write a script that reads a file “cars.csv”, into a pandas structure...
Solve using PYTHON PROGRAMMING Write a script that reads a file “cars.csv”, into a pandas structure and then print a. the first 3 rows and the last 3 of the dataset b. the 3 cars with the lowest average-mileage c. the 3 cars with the highest average-mileage. Solve using PYTHON PROGRAMMING
R Programming: create a vector for 1 to 31 and count the number of even and...
R Programming: create a vector for 1 to 31 and count the number of even and odds using ifelse()
Java Programming CS 209 Data Structure 1. Create a method that takes an ArrayList of String...
Java Programming CS 209 Data Structure 1. Create a method that takes an ArrayList of String and returns a copy of that ArrayList with no duplicates. The relative ordering of elements in the new ArrayList should be the same. Sample Input: {"qwerty", "asdfgh", "qwer", "123", "qwerty", "123", "zxcvbn", "asdfgh"} Sample Output: {"qwerty", "asdfgh", "qwer", "123", "zxcvbn"}
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT