shopping_list = []
while True:
print("\n== Список покупок ==")
print("1. Добавить товар")
print("2. Показать товар")
print("3. Удалить товар")
print("4. Очистить список")
print("5. Выход")
choice = input("Выберите действие: ").strip()
if choice == "1":
item = input("Введите название товара: ").strip()
if item:
shopping_list.append(item)
print(f"'{item}' добавлен в список.")
else:
print("Название не может быть пустым.")
elif choice == "2":
if shopping_list:
print("Ваш список покупок:")
for i, item in enumerate(shopping_list, start=1):
print(f"{i}. {item}")
else:
print("Список пуст.")
elif choice == "3":
item_to_remove = input("Введите название товара для удаления: ").strip()
if item_to_remove in shopping_list:
shopping_list.remove(item_to_remove)
print(f"'{item_to_remove}' удалён из списка.")
else:
print("Такого товара нет в списке.")
elif choice == "4":
shopping_list.clear()
print("Список очищен.")
elif choice == "5":
print("Выход. Приятных покупок!")
break
else:
print("Неверный выбор. Введите число от 1 до 5.")