1. Create a Python file called A01_R05_CUSN_barChart.py. The file will contain code that asks the user to enter today’s sales for an unlimited number of stores. It should continue to request and accept new sales values until the user enters the sentinel value of -1. For every sales entry, the application should display a bar chart representing each store’s sales.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1. Create a Python file called A01_R05_CUSN_barChart.py. The file will contain code that asks the
user to enter today’s sales for an unlimited number of stores. It should continue to request and
accept new sales values until the user enters the sentinel value of -1. For every sales entry, the
application should display a bar chart representing each store’s sales. The bar chart visual
should be composed of asterisk (*) symbols, with each asterisk representing $100. If a sales
amount entered is not exactly a multiple of 100 (e.g. 123, 450, 575, etc.), then the number of
asterisk displayed should be rounded down (e.g. $450 would display four asterisks).
2. Your code must use the following function to print bars using the following header:
def print_bar(store_num, store_sales):
o store_num is an integer value indicating the current store.
o store_sales is today’s sales for a given store such as 1000
The output of your code should resemble the following:
Enter today’s sales for store 1 :
100
Store 1 : *
Enter today’s sales for store 2 :
200
Store 2 : **
Enter today’s sales for store 3 :
1000
Store 3 : **********
Enter today’s sales for store 4 :
650
Store 4 : ******
Enter today’s sales for store 5 :
-1

Additional Notes:
1. The green text above represents the user’s input. This can be presented on either one line or
two lines.
2. This requirement will involve defining your own function (print_bar) to print the desired visual,
as well as a loop that can continue to ask the user for input until the sentinel value is entered.
 
 
 
1. Create a Python file called A01_R05_CUSN_barChart.py. The file will contain code that asks the
user to enter today's sales for an unlimited number of stores. It should continue to request and
accept new sales values until the user enters the sentinel value of -1. For every sales entry, the
application should display a bar chart representing each store's sales. The bar chart visual
should be composed of asterisk (*) symbols, with each asterisk representing $100. If a sales
amount entered is not exactly a multiple of 100 (e.g. 123, 450, 575, etc.), then the number of
asterisk displayed should be rounded down (e.g. $450 would display four asterisks).
2. Your code must use the following function to print bars using the following header:
def print_bar(store_num, store_sales):
store_num is an integer value indicating the current store.
store_sales is today's sales for a given store such as 1000
The output of your code should resemble the following:
Enter today's sales for store 1 :
100
Store 1 : *
Enter today's sales for store 2 :
200
Store 2 : **
Enter today's sales for store 3 :
1000
Store 3 : **********
Enter today's sales for store 4 :
650
Store 4 : ******
Enter today's sales for store 5 :
-1
Additional Notes:
1. The green text above represents the user's input. This can be presented on either one line or
two lines.
2. This requirement will involve defining your own function (print_bar) to print the desired visual,
as well as a loop that can continue to ask the user for input until the sentinel value is entered.
Transcribed Image Text:1. Create a Python file called A01_R05_CUSN_barChart.py. The file will contain code that asks the user to enter today's sales for an unlimited number of stores. It should continue to request and accept new sales values until the user enters the sentinel value of -1. For every sales entry, the application should display a bar chart representing each store's sales. The bar chart visual should be composed of asterisk (*) symbols, with each asterisk representing $100. If a sales amount entered is not exactly a multiple of 100 (e.g. 123, 450, 575, etc.), then the number of asterisk displayed should be rounded down (e.g. $450 would display four asterisks). 2. Your code must use the following function to print bars using the following header: def print_bar(store_num, store_sales): store_num is an integer value indicating the current store. store_sales is today's sales for a given store such as 1000 The output of your code should resemble the following: Enter today's sales for store 1 : 100 Store 1 : * Enter today's sales for store 2 : 200 Store 2 : ** Enter today's sales for store 3 : 1000 Store 3 : ********** Enter today's sales for store 4 : 650 Store 4 : ****** Enter today's sales for store 5 : -1 Additional Notes: 1. The green text above represents the user's input. This can be presented on either one line or two lines. 2. This requirement will involve defining your own function (print_bar) to print the desired visual, as well as a loop that can continue to ask the user for input until the sentinel value is entered.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY