Code. Write your program in Python using the above steps. Save your program as a .py file name yourlastname_Lab3.py Output. Your program should produce correctly labeled output with dollar amounts rounde decimal places and dollar signs displayed. See section 2.8 More About Output Sample diale Enter the number of packages purchased: 53 Discount Amount: $ 1,579.40. Total Amount: $ 6,317.60

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
My total price and discounted price are wrong.
√i>>>
Se
LIDLE Shell 3.10.6
File Edit Shell Debug Options Window Help
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) A
[MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license ()" for more
information.
Hea
>>>
Lab 3 Instructions - Protected View Saved to this PC V
0 x
= RESTART: C:\Users\CoryM
thon Python310\Morris lab3.py
enter the number of packages purchased: 53
Traceback (most recent call last):
File "C:\Users\CoryM h?vhvbi\AppData\Local\Programs\Pytho
n\Python310\Morris lab3.py", line 38, in <module>
total amount is', format (number total amount, '.2f'))
NameError: name number is not defined
>>>
h7vhvbi\AppData\Local\Programs\Py
= RESTART: C:\Users\CoryM h7vhvbi\AppData\Local\Programs\Py
O Search (Alt+Q)
Morris lab3.py-C\Users\CoryM h7vhvbi\AppData\Local\Programs\Python Python310\Morris ...
File Edit Format Run Options Window Help
6 Programe Summary: How much spaghetti sauce per serving
7
8
Data Dictionary
9 Name: How many servings of spaghetti sauce
10
11
12
13
14
thon\Python310\Morris lab3.py
enter the number of packages purchased: 53
discount amount is 83708.20 total amount is 410541.00
15 umber_packages-int (input ("enter the number of packages purchased: "))
16
17 ackages_price = 149;
18
19 otal amount number packages *packages price;
20
21 f number packages<=49:
22
23
24
25 1if number packages>-50 and number packages<-99:
discount 20
discount amount= (total amount discount)/100
discount 10
discount amount= (total amount discount)/100
26
27
291
29 lif number packages> 100 and number_packages<=149:
1301 discount 30
34 discount amount (total amount discount)/100
32
3311f number packages>-150:
34
discount-40
discount amount- (total amount discount)/100
String: Message String [A-
A Cory Morris CM
0
X
rint('discount arouncis, format (number packages discount amount, 2f'),
'total amount is, format (number packages total amount, 21'}}
Transcribed Image Text:√i>>> Se LIDLE Shell 3.10.6 File Edit Shell Debug Options Window Help Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) A [MSC v.1932 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license ()" for more information. Hea >>> Lab 3 Instructions - Protected View Saved to this PC V 0 x = RESTART: C:\Users\CoryM thon Python310\Morris lab3.py enter the number of packages purchased: 53 Traceback (most recent call last): File "C:\Users\CoryM h?vhvbi\AppData\Local\Programs\Pytho n\Python310\Morris lab3.py", line 38, in <module> total amount is', format (number total amount, '.2f')) NameError: name number is not defined >>> h7vhvbi\AppData\Local\Programs\Py = RESTART: C:\Users\CoryM h7vhvbi\AppData\Local\Programs\Py O Search (Alt+Q) Morris lab3.py-C\Users\CoryM h7vhvbi\AppData\Local\Programs\Python Python310\Morris ... File Edit Format Run Options Window Help 6 Programe Summary: How much spaghetti sauce per serving 7 8 Data Dictionary 9 Name: How many servings of spaghetti sauce 10 11 12 13 14 thon\Python310\Morris lab3.py enter the number of packages purchased: 53 discount amount is 83708.20 total amount is 410541.00 15 umber_packages-int (input ("enter the number of packages purchased: ")) 16 17 ackages_price = 149; 18 19 otal amount number packages *packages price; 20 21 f number packages<=49: 22 23 24 25 1if number packages>-50 and number packages<-99: discount 20 discount amount= (total amount discount)/100 discount 10 discount amount= (total amount discount)/100 26 27 291 29 lif number packages> 100 and number_packages<=149: 1301 discount 30 34 discount amount (total amount discount)/100 32 3311f number packages>-150: 34 discount-40 discount amount- (total amount discount)/100 String: Message String [A- A Cory Morris CM 0 X rint('discount arouncis, format (number packages discount amount, 2f'), 'total amount is, format (number packages total amount, 21'}}
ellart for your program logic.
4. To Rename File: File >> Rename >> yourlastname_lab3
5.
To Save as pdf: Export as >> pdf
6.
If for some reason this doesn't work, you can do File>>Save As and save it as an X
You may also use Powerpoint to draw your flowchart if you prefer.
See Section 3.4 for information and examples of nested decision structures and multiple ne
decision structures.
Code. Write your program in Python using the above steps. Save your program as a .py file
name yourlastname_Lab3.py
Output. Your program should produce correctly labeled output with dollar amounts rounde
decimal places and dollar signs displayed. See section 2.8 More About Output Sample diale
Enter the number of packages purchased: 53
Discount Amount: $ 1,579,40
Total Amount: $ 3,317.60
Transcribed Image Text:ellart for your program logic. 4. To Rename File: File >> Rename >> yourlastname_lab3 5. To Save as pdf: Export as >> pdf 6. If for some reason this doesn't work, you can do File>>Save As and save it as an X You may also use Powerpoint to draw your flowchart if you prefer. See Section 3.4 for information and examples of nested decision structures and multiple ne decision structures. Code. Write your program in Python using the above steps. Save your program as a .py file name yourlastname_Lab3.py Output. Your program should produce correctly labeled output with dollar amounts rounde decimal places and dollar signs displayed. See section 2.8 More About Output Sample diale Enter the number of packages purchased: 53 Discount Amount: $ 1,579,40 Total Amount: $ 3,317.60
Expert Solution
Explanation

1) Below is updated python program which calculates total price and discounted price

  • It gets the number of package purchased
  • Defines package price
  • Apply discount based on number of package
  • Display discount and total amount correctly formatted

2) In your program mistake is in print statement you are doing calculation again which is not required. program has calculated discount and total amount in if else condition blocks. you only need to calculate the price after discount

3) Save Program in python file and run 

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education