-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.py
More file actions
33 lines (33 loc) · 1.37 KB
/
Task.py
File metadata and controls
33 lines (33 loc) · 1.37 KB
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
dataBase = {}
i = 'y'
mathMax = 0
sciMax = 0
hisMax = 0
engMax = 0
while i == "y":
Name = input("Enter name of the student: ")
Math = float(input("Enter marks obtained in Mathematics: "))
Science = float(input("Enter marks obtained in Science: "))
English = float(input("Enter marks obtained in English: "))
History = float(input("Enter marks obtained in History: "))
dataBase[Name] = {'Math': Math, 'Science': Science, 'English': English, 'History': History, "Percentage":
(Math + Science + English + History) / 4}
print("Percentage obtained: " + str(dataBase[Name]["Percentage"]) + "%")
i = input("Create another entry? (y/n)")
for Name in dataBase:
if (dataBase[Name]["Math"] > mathMax):
mathMax = dataBase[Name]['Math']
topperMath = Name
if (dataBase[Name]["Science"] > sciMax):
sciMax = dataBase[Name]['Science']
topperScience = Name
if (dataBase[Name]["History"] > hisMax):
hisMax = dataBase[Name]['History']
topperHistory = Name
if (dataBase[Name]["English"] > engMax):
engMax = dataBase[Name]['English']
topperEnglish = Name
print("Top scorer in Mathematics: " + str(topperMath))
print("Top scorer in Science: : " + str(topperScience))
print("Top scorer in History: " + str(topperHistory))
print("Top scorer in English: " + str(topperEnglish))