Question

In: Computer Science

A teacher has five students who have taken four tests. The teacher uses the following grading...

A teacher has five students who have taken four tests. The teacher uses the following

grading scale to assign a letter grade to a student, based on the average of his or her four

test scores.

--------------------------------------------------------------------

Test Score Letter Grade

--------------------------------------------------------------------

90 – 100 A

>= 80 < 90 B

>= 70 < 80 C

>= 60 < 70 D

< 60 F

-------------------------------------------------------------------

Write a program that uses Python List of strings to hold the five student names, a Python

List of five characters to hold the five students’ letter grades, and a Python List of four

floats to hold each student’s set of test scores.

The program should allow the user to enter each student’s name and his or her four test

scores. It should then calculate and display each student’s average test score and a letter

grade based on the average. Input Validation: Do not accept test scores less than 0 or

greater than 100.

please use comments to describe your work.

Solutions

Expert Solution

names=[]
averages=[]
grades=[]
for i in range(5):
name = input('Enter student name: ')#get name
names.append(name)#add to array
scores=[]
for j in range(4):
score = float(input("Enter {}'s test score {}: ".format(name,j+1)))#get score
while score<0 or score>100:#if invalid score, keep asking again
score = float(input("Invalid!!\nEnter {}'s test score {}: ".format(name,j+1)))
scores.append(score)#add score to the array for holding all 4 scores
averages.append(sum(scores)/4)#after getting score, calculate average and add to averages
#determine grade
if averages[-1]>=90:
grades.append('A')
elif averages[-1]>=80:
grades.append('B')
elif averages[-1]>=70:
grades.append('C')
elif averages[-1]>=60:
grades.append('D')
else:
grades.append('F')
#print details
print('{:30s}{:10s}{:10s}'.format('Name','Average','Grade'))
for i in range(5):
print('{:30s}{:<10g}{:10s}'.format(names[i],averages[i],grades[i]))


Related Solutions

An instructor is grading tests for a class of 30 students. After the 29th student, the...
An instructor is grading tests for a class of 30 students. After the 29th student, the class mean is 51 and the class median is 81. the tests may be assumed to be in order from lowest to highest. a. how is the distribution skewed? b. what score must the 30th student get in order to raise the class average to 85.5? c.after the 30th score is added to the group, the median rises to 82. What is the 16th...
In a large statistics class, students have taken two tests. For the following situations, report what...
In a large statistics class, students have taken two tests. For the following situations, report what you would expect for the value of the correlation coefficient between test 1 score and test 2 score. Every student scores ten points lower on test 2 than on test 1. Hint: Draw a graph with test 1 score on the horizontal axis and test 2 score on the vertical axis. Place the dots for each student appropriately in the field based on how...
LAB3 YearGradeBook A teacher has 5 students who each will have 4 marking period scores. The...
LAB3 YearGradeBook A teacher has 5 students who each will have 4 marking period scores. The teacher uses the following grading scale to assign a year end letter grade to a student, based on the average of his or her 4 marking period scores. Marking Period Score                         Letter Grade 92-100                                                 A 83-91                                                   B 74-82                                                   C 65-73                                                   D 0-64                                                     F Write a class that uses a String array or an ArrayList object to hold the students’ names, an array of five...
1. As a teacher, you have some students who clearly want to learn the subject matter...
1. As a teacher, you have some students who clearly want to learn the subject matter you are teaching and other students who are interested only in the grades they get in your class. a. Considering the textbook’s discussion of extrinsic versus intrinsic motivation, how would you expect the two groups of students to differ in terms of classroom learning and performance? Describe five differences you are likely to see between them. b. Describe three strategies you might use to...
Students took four different lengths of tests. The tests consisted of either 10, 15, 20, or...
Students took four different lengths of tests. The tests consisted of either 10, 15, 20, or 25 four-choice multiple-choice items. The teacher would like to give as many items as possible without taking up too much of the class period. A longer test will take more class time. Which test should the teacher pick, to have the most items on the test during the available class time? Number of test items                                                                           10                    15                    20                    25                                     13                    17                   ...
Suppose you want to test if the mean salary of CC students who have taken statistics...
Suppose you want to test if the mean salary of CC students who have taken statistics differs from the mean salary of CC students who have not taken statistics. The mean salary of CC students who have not taken statistics is known to be 52 thousand dollars. You take a sample of 100 CC students who have taken statistics and find that they make on average 55 thousand dollars. Assume that the population standard deviation is 10 thousand dollars. What...
A sample of 20 students who had recently taken elementary statistics yielded the following informatin on...
A sample of 20 students who had recently taken elementary statistics yielded the following informatin on brand of calculator owned (T = Texas instruments, H = Hewlett Packard, C = Casio, S = Sharp): C S T C C S T T S C C T T T H H S S C Ha. Estimate the true proportion of all such students who own a Texas Instruments calculator.b. Of the 6 students who owned a TI calculator, 2 had graphing...
Martin is a piano teacher who wants to price discriminate across his students based on their...
Martin is a piano teacher who wants to price discriminate across his students based on their household income. He doesn't know the exact household income of his students, but what is a simple, verifiable characteristic he could use as a proxy for student income? age hair color parents' musical background prior purchasing history year in school address number of siblings
A teacher wanted to estimate the proportion of students who take notes in her class. She...
A teacher wanted to estimate the proportion of students who take notes in her class. She used data from a random sample of size n = 76 and found that 45 of them took notes. The 97% confidence interval for the proportion of student that take notes is:
Need to HAVE a web page that uses a loop to allow a teacher to enter...
Need to HAVE a web page that uses a loop to allow a teacher to enter the following information for all students in a class: student's name, mt  grade, f  grade, hW grade, attendance grade. program should calculate each student's numeric total grade based on the following formula:course grade = (mT*0.3)+(f*0.4)+(homework*0.2)+(attendance*0.1)File Table.html looks like this:When the button is clicked, you need to prompt the user the following information:-number of students (which will determine the number of rows in your table)-student's name-mT grade-f...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT