Untitled
unknown
python
2 years ago
1.6 kB
5
Indexable
print("Программа для работы со списком студентов\n")
student_to_marks_map = {
"Вася": [0, 1, 55, 3],
"Вася2": [0, 1, 55, 3],
"Вася3": [0, 1, 55, 3],
"Вася4": [0, 1, 55, 3],
}
student_to_marks_map["Вася"][3]
students: list[str] = []
students_marks: list[list[int]] = []
while True:
user_choice = int(input("Выберите действие\n"
"1-добавить студента\n"
"2-удалить студента\n"
"3-посмотреть весь список студентов\n"
"0-выйти из программы\n:"))
if user_choice not in [0, 1, 2, 3]:
print("Такой команды нет!")
continue
if user_choice == 0:
break
elif user_choice == 1:
new_student: str = ""
while len(new_student) == 0:
new_student = input("Введите имя студента: ").strip()
students.append(new_student)
elif user_choice == 2:
del_number = int(input("Введите номер студента для удаления: "))
students.pop(del_number - 1)
elif user_choice == 3:
student_count = len(students)
if student_count == 0:
print("Студентов не числится!")
continue
print("\nСтуденты:")
for i in range(len(students)):
print(f"#{i + 1}: {students[i]}")Editor is loading...
Leave a Comment