Does anyone know how to get the average of the random grades? She wants to generate just random grades and get the average but I had also done one where you input the grades on your end but I don't think that's what she was looking for.
import random
grade = random.randint(50,100)
grade2 = random.randint(50,100)
grade3 = random.randint(50,100)
grade4 = random.randint(50,100)
grade5 = random.randint(50,100)
if int(grade) >= 90 and int(grade) <= 100:
print ("Grade 1:", grade, "A")
elif int(grade) >= 80 and int(grade) <=90:
print("Grade 1:", grade, "B")
elif int(grade) >= 70 and int(grade) <= 80:
print("Grade 1:", grade, "C")
elif int(grade) > 60 and int(grade) <=70:
print("Grade 1:", grade,"D")
elif int(grade) <= 60:
print("Grade 1:", grade, "F")
if int(grade2) >= 90 and int(grade2) <= 100:
print ("Grade 2:", grade2, "A")
elif int(grade2) >= 80 and int(grade2) <=90:
print("Grade 2:", grade2, "B")
elif int(grade2) >= 70 and int(grade2) <= 80:
print("Grade 2:", grade2, "C")
elif int(grade2) > 60 and int(grade2) <=70:
print("Grade 2:", grade2,"D")
elif int(grade2) <= 60:
print("Grade 2:", grade2, "F")
if int(grade3) >= 90 and int(grade3) <= 100:
print ("Grade 3:", grade3, "A")
elif int(grade3) >= 80 and int(grade3) <=90:
print("Grade 3:", grade3, "B")
elif int(grade3) >= 70 and int(grade3) <= 80:
print("Grade 3:", grade3, "C")
elif int(grade3) > 60 and int(grade3) <=70:
print("Grade 3:", grade3,"D")
elif int(grade3) <= 60:
print("Grade 3:", grade3, "F")
if int(grade4) >= 90 and int(grade4) <= 100:
print ("Grade 4:", grade4, "A")
elif int(grade4) >= 80 and int(grade4) <=90:
print("Grade 4:", grade4, "B")
elif int(grade4) >= 70 and int(grade4) <= 80:
print("Grade 4:", grade, "C")
elif int(grade4) > 60 and int(grade4) <=70:
print("Grade 4:", grade4,"D")
elif int(grade4) <= 60:
print("Grade 4:", grade4, "F")
if int(grade5) >= 90 and int(grade5) <= 100:
print ("Grade 5:", grade5, "A")
elif int(grade5) >= 80 and int(grade5) <=90:
print("Grade 5:", grade5, "B")
elif int(grade5) >= 70 and int(grade5) <= 80:
print("Grade 5:", grade5, "C")
elif int(grade5) > 60 and int(grade5) <=70:
print("Grade 5:", grade5,"D")
elif int(grade5) <= 60:
print("Grade 5:", grade5, "F")
Aucun commentaire:
Enregistrer un commentaire