-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent Management System.py
More file actions
60 lines (52 loc) · 2.13 KB
/
Student Management System.py
File metadata and controls
60 lines (52 loc) · 2.13 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
students = [] #its a empty list jo k saare students ko store kregi
def add_student(): #function bnaya student ko add krne k lliye
name = input("Enter Student Name :- ") #user se naam liye uska
age = input("Enter Age :- ") #user se age li uski
course = input("Enter Course :- ") #user se course liye uska
student = {
"name": name,
"age": age,
"course": course,
} #ek tuple bna k student ki info ko usi jgh store kr diya
students.append(student) #us info k thrugh student ko add krwaya append function add krne k liye use hota hai
print("Student added succesfully!\n")
def show_student(): #function bnaaya student ko btane k liye
if not students: #agr student nhi ho
print("No Students Found!\n") #to btayga student nhi hai
return #return kra diya wps
for i , student in enumerate(students, start=1):
print(f"{i}. Name: {student["name"]}, Age: {student['age']}, Course: {student['course']}")
print()
def search_student():
search = input("enter the name for searching student:- ")
for student in students:
if student["name"] . lower() == search.lower():
print("Student Found:", student, "\n")
print("student not found.\n")
def delete_student():
name = input("enter name to delete:- ")
for student in students:
if student["name"] . lower() == name.lower():
student.remove(student)
print("student deleted successfully!\n")
print("student not found \n")
while True:
print("============== Student Manager ==============")
print("1. Add Student")
print("2. Show Student")
print("3 Search Student")
print("4 Delete Student")
choice = input("enter the choice: ")
if choice == "1":
add_student()
elif choice == "2":
show_student()
elif choice == "3":
search_student()
elif choice == "4":
delete_student()
elif choice == "5":
print("Goodbye!")
break
else:
print("Invalid Choice\n")