-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiproject03.py
More file actions
67 lines (53 loc) · 1.95 KB
/
Copy pathminiproject03.py
File metadata and controls
67 lines (53 loc) · 1.95 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
66
67
#-------------------------------------------------------------------------------------------------------------------
# Miniproject-3:Student Record Manager
#-------------------------------------------------------------------------------------------------------------------
records = {}
while True:
print("\n--- Student Record Manager ---")
print("1. Add Record")
print("2. View Records")
print("3. Search Record")
print("4. Update Record")
print("5. Delete Record")
print("6. Exit")
choice = input("Enter choice: ")
if choice == "1":
name = input("Enter name: ")
phone = input("Enter phone: ")
email = input("Enter email: ")
records[phone] = {"Name": name, "Email": email}
print("Record added successfully!")
elif choice == "2":
if not records:
print("No records found.")
else:
for phone, details in records.items():
print(f"Phone: {phone}, Name: {details['Name']}, Email: {details['Email']}")
elif choice == "3":
phone = input("Enter phone to search: ")
if phone in records:
print("Record found:", records[phone])
else:
print("Record not found.")
elif choice == "4":
phone = input("Enter phone to update: ")
if phone in records:
name = input("Enter new name: ")
email = input("Enter new email: ")
records[phone] = {"Name": name, "Email": email}
print("Record updated.")
else:
print("Record not found.")
elif choice == "5":
phone = input("Enter phone to delete: ")
if phone in records:
del records[phone]
print("Record deleted.")
else:
print("Record not found.")
elif choice == "6":
print("Exiting program...")
break
else:
print("Invalid choice. Try again.")
print("----------Executed Successfully!!-----------")