Giới thiệu sản phẩm
#Phần Mền Quản Lý Học Sinh
students = []
def display_students():
if not students:
print("Danh sách học sinh trống")
return
print("\nDanh sách học sinh:")
print("{:<5} {:<20} {:<10}".format("ID", "Tên", "Lớp"))
for i, student in enumerate(students, 1):
print("{:<5} {:<20} {:<10}".format(i, student["name"], student["class"]))
def add_students():
name = input("nhập tên học sinh: ")
students_class = input("Nhập Lớp: ")
students.append({"name": name, "class": students_class})
print("Đã thêm học sinh: ", name)
def deleat_students():
display_students()
try:
students_id = int(input("nhập tên học sinh"))
if 1 <= students_id <= len(students):
removed = students.pop(students_id - 1)
print("Đã xóa học sinh", removed("name"))
else:
print("ID ko hợp lệ")
except ValueError:
print("Vui lòng nhập số hợp lệ")
def main_menu():
while True:
print("\nChương trình quản lý học sinh")
print("1. Hiển thị danh sách học sinh")
print("2. Thêm danh sách học sinh")
print("3. Xóa học sinh")
print("4. Thoát")
choice = input("Chọn chức năng(1-4): ")
if choice == "1":
display_students()
elif choice == "2":
add_students()
elif choice == "3":
deleat_students()
elif choice == "4":
print("bye")
break
else:
print("số ko hợp lệ")
main_menu()
Hình ảnh sản phẩm

Sản phẩm cùng tác giả
Sản phẩm liên quan
Không có sản phẩm nào
Đăng nhập để tham gia bình luận