So i'm really new to python and anyways I wanted to do my own projects, I'm trying to make a small grading system right now. This is how I'm doing it at the moment, I wanted to ask for any better ways I can do this to avoid to many if statements. Please keep in mind I'm really new, I've been coding in python for only a few months.
A = "A"
B = "B"
C = "C"
D = "D"
F = "F"
Josh = [D, B]
Jack = [F, D]
Steve = [C, B]
program = "running"
while program == "running":
question = input("Type [1] to view the kids grades \n\nType [2] to change them!\n")
if question == "1":
print(f"\n{Josh}\n{Jack}\n{Steve}\n")
if question == "2":
who = input("\nWho do you want to change?\n")
if who == "Josh":
grade = input("\nFirst grade to change:\n")
if grade == "A":
Josh[0] = A
if grade == "B":
Josh[0] = B
if grade == "C":
Josh[0] = C
if grade == "D":
Josh[0] = D
if grade == "F":
Josh[0] = F
if program == "stop":
print("Shutting down.")
Aucun commentaire:
Enregistrer un commentaire