Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 Not complete Marked out of 1.00 Modify the account_summary function so it supports several additional discount codes: red 20% green 18% blue 5%

image text in transcribed

image text in transcribed

image text in transcribed

Question 3 Not complete Marked out of 1.00 Modify the account_summary function so it supports several additional discount codes: red 20% green 18% blue 5% orange 30% black 50% yellow 15% brown 35% Flag question For example Test Result account_ summary('order.txt)Original price: 154.00 Discounted price: 124.30 Savings: 29.70 Question1 Incorrect Marked out of 1.00 P Flag question A unction called account_summaryO has been provided for you. This function reads a text file called 'order.txt' with the contents shown below 10 red 20 greern 30 blue 40 red 54 orange The format for this file is price discount code where the price is an integer or floating point number, and the discount code is a string. The program will determine if the discount code is recognized, and if so, applies a discount to the corresponding price. The discounts are red 20% green 18% blue 5% If the discount code is not recognized (i.e., it does not appear in the table of discount codes above) then no discount is applied to the corresponding price After calculating the discount for each item in the file, the program should print out a summary showing the original price, the discounted price, and the savings due to discounts. An example of output from the program is Original price: 154.8 Discounted price: 140.5 Savings: 13.5 For this first task, you do not need to make any changes to the functionality of the code. You are expected to add a docstring to the function that explains the purpose of the function. Try to summarize the purpose in a single line. In subsequent tasks you will need to modify the code to add functionality For example Test Result account summary) Original price: 154.80 Discounted price: 140.50 Savings: 13.5 Question 2 Not complete Marked out of 1.00 P Flag question Modify the account_summary function so it accepts the name of the file as a parameter. The function should work with different files, as long as each file contains the correct format If you create any additional functions, they should include a docstring For example Test Result account_summary('order.txt) Original price:154.80 Discounted price: 14.50 Savings: 13.50 Question 3 Not complete Marked out of 1.00 Modify the account_summary function so it supports several additional discount codes: red 20% green 18% blue 5% orange 30% black 50% yellow 15% brown 35% Flag question For example Test Result account_ summary('order.txt)Original price: 154.00 Discounted price: 124.30 Savings: 29.70 Question1 Incorrect Marked out of 1.00 P Flag question A unction called account_summaryO has been provided for you. This function reads a text file called 'order.txt' with the contents shown below 10 red 20 greern 30 blue 40 red 54 orange The format for this file is price discount code where the price is an integer or floating point number, and the discount code is a string. The program will determine if the discount code is recognized, and if so, applies a discount to the corresponding price. The discounts are red 20% green 18% blue 5% If the discount code is not recognized (i.e., it does not appear in the table of discount codes above) then no discount is applied to the corresponding price After calculating the discount for each item in the file, the program should print out a summary showing the original price, the discounted price, and the savings due to discounts. An example of output from the program is Original price: 154.8 Discounted price: 140.5 Savings: 13.5 For this first task, you do not need to make any changes to the functionality of the code. You are expected to add a docstring to the function that explains the purpose of the function. Try to summarize the purpose in a single line. In subsequent tasks you will need to modify the code to add functionality For example Test Result account summary) Original price: 154.80 Discounted price: 140.50 Savings: 13.5 Question 2 Not complete Marked out of 1.00 P Flag question Modify the account_summary function so it accepts the name of the file as a parameter. The function should work with different files, as long as each file contains the correct format If you create any additional functions, they should include a docstring For example Test Result account_summary('order.txt) Original price:154.80 Discounted price: 14.50 Savings: 13.50

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

Step: 3

blur-text-image

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

Rules In Database Systems Third International Workshop Rids 97 Sk Vde Sweden June 26 28 1997 Proceedings Lncs 1312

Authors: Andreas Geppert ,Mikael Berndtsson

1997th Edition

3540635165, 978-3540635161

More Books

Students also viewed these Databases questions