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.
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()
Use the Python programming language to complete below (I need the New Answer for this, and...
Use the Python programming language to complete below (I need the New Answer for this, and please provide the screenshot of the source code. Thank you!): A website requests an user to input his account password. Write a program to examize the validity of the password. The valid password must consists of: At least 1 letter in [a-z] At least 1 number in [0-9] At least a letter in [A-Z] (capital) At least one special letter in [$#@] At least...
Use the Python programming language to complete below (I need the New Answer for this, and...
Use the Python programming language to complete below (I need the New Answer for this, and please provide the screenshot of the source code. Thank you!): Write a function to seek for all even numbers and odd numbers in the middle of two number A and B. Print even and odd numbers in 1 and 2020 (including both these two numbers)
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