0% found this document useful (0 votes)
18 views2 pages

Cs Menu Project

The document outlines a simple employee management system implemented in Python. It allows users to add, search, delete employees, and display employees by department through a menu-driven interface. The program continues to run until the user chooses to exit.

Uploaded by

garu31041
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Cs Menu Project

The document outlines a simple employee management system implemented in Python. It allows users to add, search, delete employees, and display employees by department through a menu-driven interface. The program continues to run until the user chooses to exit.

Uploaded by

garu31041
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1 employees = []

2
3 while True:
4 print("5Menu:")
5 print("1. Add new employee")
6 print("2. Search an employee")
7 print("3. Delete an employee")
8 print("4. Employee details of a department")
9 print("5. Exit")
10 choice = int(input("Enter your choice: "))
11
12 if choice == 1:
13 emp_no = input("Enter employee number: ")
14 name = input("Enter employee name: ")
15 department = input("Enter employee department: ")
16 salary = int(input("Enter employee salary: "))
17 post = input("Enter employee post: ")
18 employee = [emp_no, name, department, salary, post]
19 employees.append(employee)
20 print("Employee added successfully")
21
22 elif choice == 2:
23 emp_no = input("Enter employee no. to search: ")
24 found = False
25 for i in employees:
26 if i[0] == emp_no:
27 print("Employee found: ",i)
28 found = True
29 break
30 if not found:
31 print("Employee not found!")
32
33 elif choice == 3:
34 emp_no = input("Enter employee number to delete: ")
35 found = False
36 for i in employees:
37 if i[0] == emp_no:
38 employees.remove(i)
39 print("Employee deleted successfully!")
40 found = True
41 break
42 if not found:
43 print("Employee not found!")
44
45 elif choice == 4:
46 department = input("Enter department to display
employees: ")
47 found = False
48 for i in employees:
49 if i[2] == department:
50 print(i)
51 found = True
52 if not found:
53 print("No employee found in this department!")
54
55 elif choice == 5:
56 break
57
58 else:
59 print("Invalid choice! Please try again.")
60

You might also like