-
Notifications
You must be signed in to change notification settings - Fork 6
/
student management.py
48 lines (48 loc) · 1.58 KB
/
student management.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
print('Welcome to student management')
menu()
students = []
student = {}
def menu():
print('Enter an option of your choice')
print('1 Add students\n2 Delete students \n3 Find student \n4 Exit')
option = input('= ')
if option == '1':
add()
elif option == '2':
delstu()
elif option == '3':
findstu()
elif option == '4':
print('Good bye')
else:
while option != '1' or option != '2' or option != '3':
print('Invalid entry, enter again')
option = input('= ')
def add():
num = int(input('how many students do you want to enroll?'))
for i in range (num):
student = {}
student['Name'] = input('Enter student Name: ' )
student['number'] = input('Enter roll number: ')
student['quarter'] = input('Enter quarter: ')
students.append(student)
print('Number of students enrolled: ',len(students))
print('press any key to go back to menu')
goto_menu = input()
menu()
def delstu():
delname = input('Enter the name of the student whose data you want to delete')
for student in students :
if student['Name'] == delname:
del student['Name']
del student['number']
del student['quarter']
goto_menu = input('Enter any key to go back')
menu()
def findstu():
findname = input('Enter student name to get his data: ')
for student in students:
if student[Name] == findname:
print(student)
goto_menu = input('Enter any key to go back')
menu()