For the second fix my code challenge on Day 33 part of the solution is missing.
The problem is with the
append
function. We have two objects backwards. The list name comes first and then what’s being added to the list goes inside()
. Hint: You will see the same issue withremove
too.It always needs to be:
listname.append()
orlistname.remove()
myAgenda = []
def printList():
print()
for item in myAgenda:
print(item)
print()
while True:
menu = input("Add or Remove?: ")
if menu == "add":
item = input("What's next on the Agenda?: ")
myAgenda.append(item)
elif menu == "remove":
item = ("What do you want to remove?: ")
if item in myAgenda:
myAgenda.remove(item)
else:
print(f"{item} was not in the list")
printList()
The other problem that isn’t mentioned
elif menu == "remove":
item = ("What do you want to remove?: ")
This should be
elif menu == "remove":
item = input("What do you want to remove?: ")