hi i have received an error message from this i cannot trace it in my understanding, please help me fix this:
TypeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_16408\1712083565.py in <module>
84 clear_output()
85 start_menu()
---> 86 remove_item(item)
87 continue
88 else:
TypeError: remove_item() takes 0 positional arguments but 1 was given
the error above happens after i enter an item to be removed in the CODE 1, however the in CODE 2 sample doesn’t raise this concern when i enter data for removal. please pardon me with the plenty code you have to read and assist. thank you in advance.
**CODE 1**
def remove_item():
if item in shopping_list:
shopping_list.remove(item)
print(f"{item} was removed from your shopping list!")
print(f"You now have {len(shopping_list)} item(s) on you list!")
else:
print(f"You already have {item} in your list, can't add this again!")
elif user_input == 'REMOVE':
clear_output()
show_shopping_list()
item = input("What are to remove:? ")
clear_output()
start_menu()
remove_item(item)
continue
same code i have here but no issues:
**CODE 2**
def remove_item(item):
item = item.capitalize()
if item in shoppinglist:
shoppinglist.remove(item)
print(f'{item} was removed from the shopping list')
print("You now have {} item(s) left on your shoppinglist".format(len(shoppinglist)))
print(f"You now have {len(shopping_list)} item(s) on you list!")
else:
print(f"{item} does not exist in you shopping list, and can't be removed:")
elif user_input == 'REMOVE':
clear_output()
show_shopping_list()
item = input("What are to remove:? ")
clear_output()
start_menu()
remove_item(item)
continue