-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade.py
34 lines (31 loc) · 985 Bytes
/
grade.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
length = int(input("Enter number of student:")) #size of students
student ={} #empty dict
for i in range(length):
s = input("Enter student name :")
eng = int(input("Enter marks in english :"))
math = int(input("Enter marks in maths :"))
his = int(input("Enter marks in history :"))
sci = int(input("Enter marks in science :"))
percent = (eng+math+his+sci)/4 #percentage
student[s] = {"english":eng,"maths":math,"history":his,"science":sci,"percent":percent}
print()
print()
print(s)
print(student[s]["percent"])
print()
print()
print(student)
print()
print()
#for finding top scorer in each subject
print("\t\t Top Scorers ")
subject = ["english","maths","history","science"]
for sub in subject:
highest = 0
for key,value in student.items():
if value[sub]>highest:
highest = value[sub]
highestvalue = key
print(highestvalue)
print(sub)
print()