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): 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.
Step by step
Solved in 3 steps with 1 images