Untitled
unknown
python
2 years ago
1.0 kB
7
Indexable
print("Программа для работы со списком студентов\n")
student_list = ["Вася", "Петя"]
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 = input("Введите имя студента: ")
student_list.append(new_student)
elif user_choice == 2:
del_number = int(input("Введите номер студента для удаления: "))
student_list.pop(del_number)
elif user_choice == 3:
print(student_list)Editor is loading...
Leave a Comment