lundi 4 mai 2020

Is there a way to make this a a cleaner or better looking algorithm? (Grade/Average calculator)

So I made this mental math quiz, besides the point. but I want to make a percent/average of the grade the person would get on the quiz. So I wrote this out, and it works. But it is for a project and I want it to look more presentable than it does right now. Thanks in advance.

score = 5
score2 = 5

def calcGrade():
    global score
    global score2
    grade = score + score2 
    grading = grade / 10
    gradinge = grading * 100
    print("your grade is",gradinge)

calcGrade()

and don't worry, global variables are allowed.

Aucun commentaire:

Enregistrer un commentaire