forked from Tonguesten36/pp2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.student.mark..py
69 lines (53 loc) · 2.74 KB
/
1.student.mark..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
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
66
67
def input_student():
#Student info
n_students = int(input("Input number of students: "))
list_students = [{'Name': None, 'DoB': None, 'ID': None} for i in range(n_students)] #Save student list
for i in range(0, n_students):
print("Student " + str(i+1))
list_students[i]['Name'] = input("Input student name: ")
list_students[i]['DoB'] = input("Input student DoB: ")
list_students[i]['ID'] = input("Input student id: ")
print(list_students[0])
print("\n")
return list_students
def input_course():
list_students = input_student()
#Courses info
cours_num = int(input("Input number of courses: "))
list_courses = [{'ID': None,
'Name': None,
'Marks of students': [{'Score': None,
'Student name': None,
'Student ID': None}
for i in range(len(list_students))]}
for i in range(cours_num)]
for i in range(0, cours_num):
list_courses[i]['ID'] = input("Input course " + str(i+1) + " ID: ")
list_courses[i]['Name'] = input("Input course " + str(i+1) + "name: ")
print("Input marks of students: ")
for j in range(len(list_students)):
list_courses[i]['Marks of students'][j]['Score'] = input("\t Input score for " + list_students[j]['Name']
+ " " + list_students[j]['ID'] + ": " )
list_courses[i]['Marks of students'][j]['Student name'] = list_students[j]['Name']
list_courses[i]['Marks of students'][j]['Student ID'] = list_students[j]['ID']
return list_courses
def show_courses(list_courses):
course_ID = input("Enter course ID: ")
for k in range(len(list_courses)):
if list_courses[k]['ID'] == course_ID:
print("\n" + list_courses[k]['Name'] + " " + list_courses[k]['ID'])
print('Marks of students: ')
for j in range(len(list_courses[k]['Marks of students'])):
print('\t' + "Name: " + list_courses[k]['Marks of students'][j]['Student name'])
print('\t' + "ID: " + list_courses[k]['Marks of students'][j]['Student ID'])
print('\t' + "Score: " + list_courses[k]['Marks of students'][j]['Score'])
print('\n')
#Init data
while True:
list_courses = input_course()
while True:
show_courses(list_courses)
if input("Do you want to continue searching? (Y/N): ") == 'N':
break
if input("Do you want to redo? (Y/N): ") == 'N':
break