When menu items come from a file, each line may carry an invisible newline character. Calling strip() removes invisible characters from both ends of each string, so a printed list becomes clean and readable. section 5.0 section 5.1
Clean Erik’s menu
Read the file into a temporary list, loop over its items, strip each item, and append the cleaned value to a new list. The result changes ['coffee\n', 'chocolate\n', 'decaf\n'] into ['coffee', 'chocolate', 'decaf']. The same helper can clean drinks, flavors, and toppings. section 5.0
f = open("drinks.txt")
temp = f.readlines()
drinks = []
for item in temp:
new_item = item.strip()
drinks.append(new_item)
print(drinks)
Shows the complete loop that applies strip() to every item and builds the cleaned drinks list. section 5.0



