Employee Management System Code Development in CG Style – AI Generated Video | Hailuo AI

Generate & Play Hailuo AI video:# employee_management.py employees = [] def add_employee(): name = input("Enter employee name: ") id = input("Enter employee ID: ") position = input("Enter position: ") salary = float(input("Enter salary: ")) employee = {"name": name, "id": id, "position": position, "salary": salary} employees.append(employee) print("Employee added successfully.") def list_employees(): if not employees: print("No employees found.") else: for emp in employees: print(f"ID: {emp['id']} | Name: {emp['name']} | Position: {emp['position']} | Salary: {emp['salary']}") def update_employee(): emp_id = input("Enter employee ID to update: ") for emp in employees: if emp['id'] == emp_id: print("Leave field blank to keep current value.") name = input(f"Enter new name ({emp['name']}): ") or emp['name'] position = input(f"Enter new position ({emp['position']}): ") or emp['position'] salary_input = input(f"Enter new salary ({emp['salary']}): ") salary = float(salary_input) if salary_input else emp['salary'] emp.update({"name": name, "position": position, "salary": salary}) print("Employee updated successfully.") return print("Employee not found.") def delete_employee(): emp_id = input("Enter employee ID to delete: ") for emp in employees: if emp['id'] == emp_id: employees.remove(emp) print("Employee deleted successfully.") return print("Employee not found.") def main(): while True: print("\n=== Employee Management Menu ===") print("1. Add Employee") print("2. List Employees") print("3. Update Employee") print("4. Delete Employee") print("5. Exit") choice = input("Enter your choice (1-5): ") if choice == '1': add_employee() elif choice == '2': list_employees()

Original AI Prompt

Generate & Play Hailuo AI video:# employee_management.py employees = [] def add_employee(): name = input("Enter employee name: ") id = input("Enter employee ID: ") position = input("Enter position: ") salary = float(input("Enter salary: ")) employee = {"name": name, "id": id, "position": position, "salary": salary} employees.append(employee) print("Employee added successfully.") def list_employees(): if not employees: print("No employees found.") else: for emp in employees: print(f"ID: {emp['id']} | Name: {emp['name']} | Position: {emp['position']} | Salary: {emp['salary']}") def update_employee(): emp_id = input("Enter employee ID to update: ") for emp in employees: if emp['id'] == emp_id: print("Leave field blank to keep current value.") name = input(f"Enter new name ({emp['name']}): ") or emp['name'] position = input(f"Enter new position ({emp['position']}): ") or emp['position'] salary_input = input(f"Enter new salary ({emp['salary']}): ") salary = float(salary_input) if salary_input else emp['salary'] emp.update({"name": name, "position": position, "salary": salary}) print("Employee updated successfully.") return print("Employee not found.") def delete_employee(): emp_id = input("Enter employee ID to delete: ") for emp in employees: if emp['id'] == emp_id: employees.remove(emp) print("Employee deleted successfully.") return print("Employee not found.") def main(): while True: print("\n=== Employee Management Menu ===") print("1. Add Employee") print("2. List Employees") print("3. Update Employee") print("4. Delete Employee") print("5. Exit") choice = input("Enter your choice (1-5): ") if choice == '1': add_employee() elif choice == '2': list_employees()

Download

AI-Powered Analysis

The video demonstrates the development of an employee management system using Python, focusing on basic CRUD operations.

You Might Also Like