<> utilize Python Make a score management system
Recently, I've done one for boredom :
def Welcome(): print(" Welcome to the score management system !") print(" Here you can check the scores of your classmates !") def mune1(): print(
"1. Display data ") print("2. Query results ") print("3. sign out ") def mune2(): print("1. chinese ") print("2. mathematics ")
print("3. English ") print("4. Total score ") print("5. average ") print("6. ranking ") print("7. sign out ") def
GetData(): sum = [] f = open('D:/score.txt') list = f.readlines() for i in list[
1:]: i = i.strip('\n') i = i.split() sum.append(i) return sum # Main function Welcome() sum
=GetData() while 1: mune1() x=eval(input(" Please enter :")) if x==1: print("{} {} {} {}
{} {} {}".format(' full name ', ' Student number ', ' chinese ', ' mathematics ', ' English ', ' Total score ', ' ranking ')) for i in sum: print(
"{} {} {} {} {} {} {}".format(i[0],i[1],i[2],i[3],i[4],i[5],i[6]))
# The above output format can also be changed ! elif x==2: while 1: mune2() x=eval(input(" Please enter :")) if x==1: x1=
input(" Enter student number or name :") for i in sum: if i[0]==x1 or i[1]==x1: print("{}".format(i[2]
)) print(" come on. , believe oneself !") elif x == 2: x1 = input(" Enter student number or name :") for i in sum: if i[0]
== x1 or i[1] == x1: print("{}".format(i[3])) print(" come on. , believe oneself !") elif x == 3: x1
= input(" Enter student number or name :") for i in sum: if i[0] == x1 or i[1] == x1: print("{}".
format(i[4])) print(" come on. , believe oneself !") elif x == 4: x1 = input(" Enter student number or name :") for i in
sum: if i[0] == x1 or i[1] == x1: print("{}".format(i[5])) print(" come on. , believe oneself !")
elif x==5: score=0 x1 = input(" Enter student number or name !") for i in sum: if i[0] == x1 or i[1]
== x1: score=(int(i[2])+int(i[3])+int(i[4]))/3 print("{:.2f}".format(score))
print(" come on. , believe oneself !") elif x == 6: x1 = input(" Enter student number or name !") for i in sum: if i[0] ==
x1or i[1] == x1: print("{}".format(i[6])) print(" come on. , believe oneself !") elif x==7: break
else: print(" The number you entered is not recognized , Please input again !") elif x==3: break else: print(
" The number you entered is not recognized , Please input again !")
In this paper score.txt I wrote the papers myself !
full name Student number chinese mathematics English Total score ranking
Gong Lei 2019101 104 137 117 358 1
Zhu Qian 2019102 100 110 110 320 2
It's just like this !
Technology
Daily Recommendation