Example output
def main():
initial_shopping_list = [
"Olive oil",
"Sunflower oil",
"Cheese",
"Butter",
"Mango",
"Banana",
"Ginger",
"Milk",
"Bread",
"Chicken",
"Sauerkraut",
]
shopping_list = set(…)
print("Enter items for your shopping list. Type 'DONE' to finish.")
while True:
item = input(…).strip()
if item.upper() == "DONE":
break
item_lower = item.lower()
if item_lower in shopping_list:
print(…)
else:
shopping_list.add(item_lower)
print(… added to the list.")
save_list_to_file(shopping_list)
print("Shopping list saved to shopping_list.txt")
def save_list_to_file(shopping_list):
with open("shopping_list.txt", "w") as file:
for item in shopping_list:
file.write(…)
if __name__ == "__main__":
main()