Question

# Please use Python to do this question.

# import turtle to do this question.

Write a function, grade_histogram(t,mu,sigma,n), which uses the turtle module to make a histogram for quiz score data for n = 100 students.   First, create the data using gauss(mu,sigma), from the random module. mu is the average and sigma is the standard deviation of the scores and is a measure of the spread of the data scores. When the quiz data is generated, check to make sure that each quiz score is between 0 and 100, inclusive. Put the data into a list. Take the data you generated with the specified mean and standard deviation & make a histogram of the number of A’s, B’s, C’s, D’s and F’s, according to the following rubric:

A: 95 <= score <= 100

B: 85 <= score <     95

C: 75 <= score <     85

D: 65 <= score <    75

F:              score < 65

Use appropriate helper functions to make your code easy to write and easy to read.

Scale the histogram height so the maximum height is 300 turtle steps. Your code should have output like the sample shown below which uses 100 students with mu = 80 and sigma = 10, and which includes the labels shown on top of each of the histogram bars. Note that the number of A’s, B’s, C’s, D’s and E’s must equal to n.

grade_histogram(alex,80,10,100)

38 Cs 23 Ds 22 Bs 9 Fs 8 As

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import matplotlib.pyplot as plt

import numpy as np

mu, sigma = 100, 15

x = mu + sigma * np.random.randn(10000)

bins = [0, 40, 60, 75, 90, 110, 125, 140, 160, 200]

hist, bins = np.histogram(x, bins=bins)

width = np.diff(bins)

center = (bins[:-1] + bins[1:]) / 2

fig, ax = plt.subplots(figsize=(8,3))

ax.bar(center, hist, align='center', width=width)

ax.set_xticks(bins)

fig.savefig("/tmp/out.png")

plt.show()

Add a comment
Know the answer?
Add Answer to:
# Please use Python to do this question. # import turtle to do this question. Write...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need help on this Matlab problem, I do not know how to do it Problem 2....

    Need help on this Matlab problem, I do not know how to do it Problem 2. (2D Sorting) The following table contains the scores for the 4 students A,B.C and D for four Homeworks HW1 50 20 85 65 HW2HW 45 80 30 95 HW4 75 35 15 80 Student A Student B Student C Student D 40 60 100 a) Create a matrix with the above data b) What is the minimum score of all four homework? (use the...

  • Please answer all questions! thanks :) VI/ Test scores from a math midterm are as follows:...

    Please answer all questions! thanks :) VI/ Test scores from a math midterm are as follows: 79, 90, 85, 89, 70, 59, 75, 64, 83, 78, 75, 77, 78, 77, 67, 85, 74, 52, 87, 72, 69, 76, 61, 77, 93, 86, 79, 90, 74, 67, 51, 75, 77, 82, 78, 60, 86, 72, 91, 95, 82 Complete the frequency distribution table to include all data a. Class Tallies Class Midpoint Relative Cumulative Frequency relative freq boundaries Frequency 51 57...

  • Develop an interactive program to assist a Philosophy professor in reporting students’ grades for his PHIL-224.N1...

    Develop an interactive program to assist a Philosophy professor in reporting students’ grades for his PHIL-224.N1 to the Office of Registrar at the end of the semester. Display an introductory paragraph for the user then prompt the user to enter a student record (student ID number and five exam-scores – all on one line). The scores will be in the range of 0-100. The sentinel value of -1 will be used to mark the end of data. The instructor has...

  • Please use R Part I: qqplots. This part deals with qaplots of al inds. Let's do...

    Please use R Part I: qqplots. This part deals with qaplots of al inds. Let's do some easy experiments, first. Let's take a sample from a normal distribution with mu-2, sigma -3, and then look at the hist and the qqplot of that data: set.seed(3) n 100 # Sample size # Sample from N(mu-2, sigma-3) # Looks normal. But that depends on breaks. x morm(n,2.3) hist(x) qqnorm(x) # This doesn't depend on binsize, and it looks linear. abline(2,3, col-2) What...

  • THIS IS FINAL COURSE ASSIGNMENT, PLEASE FOLLOW ALL REQUIREMENTS. Hello, please help write program in JAVA...

    THIS IS FINAL COURSE ASSIGNMENT, PLEASE FOLLOW ALL REQUIREMENTS. Hello, please help write program in JAVA that reads students’ names followed by their test scores from "data.txt" file. The program should output "out.txt" file where each student’s name is followed by the test scores and the relevant grade, also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in an instance of class variable of type...

  • PLEASE USE BASIC C++ CODE PLEASE USE BASIC C++ CODE PLEASE HAVE DONE AS SOON AS...

    PLEASE USE BASIC C++ CODE PLEASE USE BASIC C++ CODE PLEASE HAVE DONE AS SOON AS POSSIBLE THANK YOU I REALLY APPRECIATE IT FILE TEXT: Mary 80 90 75 90 85 Joe 80 65 80 80 80 Same program as Quiz #4, but this time it must be done with arrays: Write a program that calculates the average of 5 test scores for each student on the file. Function 1--write a function to read the student's name 5 test scores...

  • Please help me with this program.You are to write a C++ program that will read in...

    Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...

  • Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate...

    Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...

  • Midterm1 = (83.33, 98.33, 75, 91.67, 96.67, 95, 86.67, 65, 100, 100, 80, 88.33, 96.67, 96.67,...

    Midterm1 = (83.33, 98.33, 75, 91.67, 96.67, 95, 86.67, 65, 100, 100, 80, 88.33, 96.67, 96.67, 90, 96.67, 86.67, 93.33, 80, 91.67, 98.33, 86.67, 85, 86.67, 95, 83.33, 96.67, 81.67, 98.33, 100, 95, 93.33, 91.67, 88.33, 98.33, 93.33, 98.33, 93.33, 85, 88.33, 100, 98.33, 96.67, 90, 86.67, 100, 96.67, 98.33, 90, 96.67, 86.67, 95, 78.33, 86.67, 100, 81.67, 96.67, 91.67, 96.67, 96.67, 95, 96.67, 73.33, 100, 93.33, 96.67, 88.33, 70, 96.67, 96.67, 100, 88.33, 96.67, 100, 88.33, 100, 78.33, 93.33,...

  • 2. (11 pts.) Do creative people make better teachers? Ten teachers at a large university were...

    2. (11 pts.) Do creative people make better teachers? Ten teachers at a large university were given a creativity test (scores range from 0 to 20, with higher scores indicating greater creativity) and were evaluated regarding teaching performance by students and peers (a score of 100 indicates an average performance, and larger scores indicate better performance). The creativity scores and teaching performance scores are given below. Creativity score Performance score 9 93 7 89 8 95 13 101 10 102...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT