I am meant to be making a grading program that is based on randomly generated letter grades (A-F). The program asks for the amount of assignments and prints the assignment number with the letter grade. It should also find the average grade of the randomly generated grade. The output should look something like this:
Assignment 1 grade is an F
Assignment 2 grade is a C
Assignment 3 ...
The average is a ...
I have a list set up to randomly generate the letter grade. I am having trouble setting code to find the average of the letter grades. Also, my loop does not spit out a new letter grade every time as it should. Here is some of my code:
numberlist = []
numberlist.append("A")
numberlist.append("B")
numberlist.append("C")
numberlist.append("D")
numberlist.append("F")
numberindex = random.randint(0, 5)
count = 1
for i in range(total):
print("The grade for assignment", count, \
"is a {}".format(numberlist[numberindex]))
count = count + 1
It currently prints:
Assignment 1 grade is an F
Assignment 2 grade is an F
Assignment 3 grade is an F...
Aucun commentaire:
Enregistrer un commentaire