0% found this document useful (0 votes)
2 views

school management python code

The document outlines a School Staff Management System that allows users to manage staff data through various options such as adding, deleting, modifying, and searching for staff. It supports categorizing staff into teaching and non-teaching types and displays their details accordingly. The system runs in a loop until the user chooses to exit.

Uploaded by

luciferfps007
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

school management python code

The document outlines a School Staff Management System that allows users to manage staff data through various options such as adding, deleting, modifying, and searching for staff. It supports categorizing staff into teaching and non-teaching types and displays their details accordingly. The system runs in a loop until the user chooses to exit.

Uploaded by

luciferfps007
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

staff_data = {}

while True:
print("\nSchool Staff Management System")
print("1. Add Staff")
print("2. Delete Staff")
print("3. Show All Staff")
print("4. Show Non-Teaching Staff")
print("5. Show teaching Staff")
print("6. Modify Staff Information")
print("7. Search for Staff")
print("8. Exit")

choice = int(input("Enter your choice: "))

if choice == 1:
name = input("Enter staff name: ")
staff_type = input("Enter staff type (Teaching/Non-Teaching): ")
salary = float(input("Enter salary: "))
staff_data[name] = {'type': staff_type, 'salary': salary}
print("Staff added successfully!")

elif choice == 2:
name = input("Enter name of staff to delete: ")
if name in staff_data:
del staff_data[name]
print("Staff deleted successfully!")
else:
print("Staff not found!")

elif choice == 3:
print("\nAll Staff:")
for name, details in staff_data.items():
print(f"Name: {name}")
print(f"Type: {details['type']}")
print(f"Salary: {details['salary']}")
print("-" * 20)

elif choice == 4:
print("\nNon-Teaching Staff:")
for name, details in staff_data.items():
if details['type'] == 'Non-Teaching':
print(f"Name: {name}")
print(f"Salary: {details['salary']}")
print("-" * 20)
elif choice == 5:
print("\n Teaching Staff:")
for name, details in staff_data.items():
if details['type'] == 'teaching':
print(f"name: {name}")
print(f"Type: {details['type']}")
print(f"Salary: {details['salary']}")
print("-" * 20)
elif choice == 6:
name = input("Enter name of staff to modify: ")
if name in staff_data:
new_salary = float(input("Enter new salary: "))
staff_data[name]['salary'] = new_salary
print("Staff information modified successfully!")
else:
print("Staff not found!")

elif choice == 7:
name = input("Enter name of staff to search: ")
if name in staff_data:
print(f"Name: {name}")
print(f"Type: {staff_data[name]['type']}")
print(f"Salary: {staff_data[name]['salary']}")
else:
print("Staff not found!")

elif choice == 8:
print("Exiting...")
break

else:
print("Invalid choice!")

You might also like