-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
65 lines (44 loc) · 1.47 KB
/
main.py
File metadata and controls
65 lines (44 loc) · 1.47 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def handle_student_details():
students_details = {}
count = 1
while (count <= 3):
one_student = {}
name = input("Key in the name of the student: ")
id_no = input("Key in the id number of the student: ")
print(" ")
one_student["name"]=name
students_details[id_no] = one_student
print(students_details)
print(" ")
count = count + 1
print(students_details)
return students_details
def handle_subjects():
estvalue = handle_student_details()
print("VALUE IS: ", estvalue)
subjects = []
count = 0
while count<5:
subject = input("Key in subject: ")
subjects.append(subject)
print(subjects)
print(" ")
count = count+1
# for x in estvalue:
# for subject in subjects:
# estvalue[x][subject] = None
# print("NEW VALUE IS: ", estvalue)
for x in estvalue:
add=0
for subject in subjects:
mark = input("Key in " + subject + " mark for student with id " + x + " ")
estvalue[x][subject] = mark
add = add+int(mark)
print("total for id:" + x + " =" + str(add))
avg = int(add)/5
print("average for id:" + x + " =" + str(avg))
print(" ")
estvalue[x]["total"] = add
estvalue[x]["average"] = add/5
print("NEW VALUE IS: ", estvalue)
handle_subjects()