Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is a2_partB text this is test input I need help with part C. I understand that I am supposed to combine both the def
this is a2_partB text
this is test input
I need help with part C. I understand that I am supposed to combine both the def functions into one module. How do I do the last two bullet points?
Thank you
Part A You need to write a program that does the following: get numeric inputs interactively from the user, till the user types in s or S to stop the input The numbers need to be between 0 and 5 only The numbers can be repeated The user has to provide a minimum of 12 numbers . Once the input phase if complete, a frequency chart for the numbers needs to be provided as the output Lets say, the user provided the following numbers: 2,3,1,2,2,3,4,3,4,5,4,4,4,4,3,2,2,0,1,1,2,2,3,4,4,4,5 o The following frequency chart should be shown 0:* 1:*** 2:******* 3:***** 4: * ****** 5:** Please employ dictionaries in this part The program should have at least two functions o validate_Input(arguments, as necessary) o draw_Frequency_Chart(arguments, as necessary) Hint: Dictionaries and sorting # Let's work with dictionaries orders = { 'cappuccino': 54, 'latte': 56, 'espresso': 72, 'americano': 48, 'cortado': 41 } # iterate over a dictionary -- unsorted for k,v in orders. items(): print(k,v) # iterate over a dictionary -- sorted for k,v in sorted(orders.items(): print(k,v) Part B This program reads input from a text file, process that input text using dictionaries, and write formatted output to another file. The program starts by first requesting the user to type in the name of the input file, and o then eequesting the user to type in the name of the output file The input file is supposed to contain numbers separated by commas. However, we all know that people make mistakes, or mistakes somehow always creep in. A sample input file (named test_input.txt) is provided for test purposes The file may contain sequences like the following: 12.34,5,5,b3.45,45-4.4, In addition, the file has multiple lines . So your task is to read that file and extract and choose all legitimate numeric values. Obe condition for a numeric value being legitimate is that the number should lie between 0 and 10. Once you have the numeric values, you need to draw a histogram and provide summary statistics like: the total count of numbers processed, minimum number and maximum number. A sample output is shown below Important Instead of sending this output to the screen, this output needs to be saved or written to a file named a2_partBout.txt. I have provided the a2_partBout.txt file that corresponds to the sample input file test_input.txt. Note from the sample output file that you will be creating 10 buckets to count the frequency. So, if a number falls between 0 and 1 ("0 toStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started