ASSIGNMENT
Q.14
Q.1 Write a Python program to check whether multiple numbers are Even or Odd.
# Menu-driven program to manage a list of student names students = [] while True: print("\n========== STUDENT LIST MENU ==========") print("1. Add Student") print("2. Insert Student at Position") print("3. Remove Student") print("4. Delete Student by Index") print("5. Search Student") print("6. Count Student Name") print("7. Find Student Position") print("8. Sort Student List") print("9. Reverse Student List") print("10. Copy Student List") print("11. Clear Student List") print("12. Display Student List") print("13. Exit") print("=======================================") choice = int(input("Enter your choice: ")) if choice == 1: # Add Student name = input("Enter student name: ") students.append(name) print("Student added successfully.") elif choice == 2: # Insert Student at Position name = input("Enter student name: ") position = int(input("Enter position (starting from 0): ")) if 0 <= position <= len(students): students.insert(position, name) print("Student inserted successfully.") else: print("Invalid position.") elif choice == 3: # Remove Student name = input("Enter student name to remove: ") if name in students: students.remove(name) print("Student removed successfully.") else: print("Student not found.") elif choice == 4: # Delete Student by Index index = int(input("Enter index to delete: ")) if 0 <= index < len(students): deleted_name = students.pop(index) print(deleted_name, "deleted successfully.") else: print("Invalid index.") elif choice == 5: # Search Student name = input("Enter student name to search: ") if name in students: print("Student found.") else: print("Student not found.") elif choice == 6: # Count Student Name name = input("Enter student name: ") count = students.count(name) print("Number of occurrences:", count) elif choice == 7: # Find Student Position name = input("Enter student name: ") if name in students: position = students.index(name) print("Student position:", position) else: print("Student not found.") elif choice == 8: # Sort Student List students.sort() print("Student list sorted successfully.") elif choice == 9: # Reverse Student List students.reverse() print("Student list reversed successfully.") elif choice == 10: # Copy Student List copied_students = students.copy() print("Copied Student List:", copied_students) elif choice == 11: # Clear Student List students.clear() print("Student list cleared successfully.") elif choice == 12: # Display Student List if len(students) == 0: print("Student list is empty.") else: print("Student List:") for student in students: print(student) elif choice == 13: # Exit print("Program terminated.") break else: print("Invalid choice. Please try again.")


