Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Demonstrate a basic knowledge of frequency distributions and histograms by writing a python program. write code to create a frequency distribution chart that emulates a

Demonstrate a basic knowledge of frequency distributions and histograms by writing a python program. write code to create a frequency distribution chart that emulates a histogram for a given dataset without access to special libraries.I have provided a base for this program tha should be added to and not altered, this what I have thus far:
#DO NOT MODIFY THE CODE IN THIS FILE
#File: Proj02.py
#Revised: 06/27/23
'''
Among other things, this project requires you to
demonstrate a basic knowledge of frequency
distributions and histograms. In this project,
you will write code to create a frequency
distribution chart that emulates a histogram for a
given dataset without access to special libraries.
You will not be required to write the code to produce
the chart. You simply need to write the code to
produce the data that will be used by the following
code to produce the chart.
'''
from Proj02Runner import Runner
import sys
import textwrap
print("
Expected three numeric command-line arguments.")
#Get the command-line arguments and put them in a
#list named args.
args = list(map(int, sys.argv[1:]))
# Check if the user has entered three command-line arguments
if len(args)!=3:
print("Missing command-line arguments")
print("Use default values in place of command-line arguments")
args =[6,10,4]
print('The default values are:',args)
else:
print("The command-line arguments are:", args)
#Use the command-line arguments to create a dataset.
data=list(
range(0,11))+list(
range(1,10))+list(
range(2,9))+list(
range(3,8))+list(
range(4,7))+list(
range(5,6))+list(
range(int(args[0]),int(args[1])))*int(args[2])
print("The dataset is:")
wrapped_list = textwrap.wrap(str(data), width=50)
for line in wrapped_list:
print(line)
print("
Your code may not import anything.
")
print("Execute student code.")
#Call student's run function to process the dataset
#and return the result.
result = Runner.run(data)
print("
Display data returned by student code.")
#Use the list returned from student's run function to
#display a frequency distribution chart.
#Find the maximum value in the result
max_value = max(result)
# Loop through each row
for i in range(max_value, 0,-1):
# Loop through each value in the result
for j in range(len(result)):
if result[j]>= i:
print(" x ", end="")
else:
print("", end="")
print()
# Print the x-axis labels
for i in range(len(result)):
print("---", end="")
print()
#Print the list returned by the student's run function.
print(result)

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

More Books

Students also viewed these Databases questions

Question

What are five dimensions of feasibility study?

Answered: 1 week ago

Question

6. Explain some strategies for dealing with conflict.

Answered: 1 week ago