Here is my code:
list1 = ['monkey', 'banana', 'pizza']
list2 = []
for x in list1:
input = input(f"Do you want to add {x} to list 2? [y/n] ")
if input == "y" or input == "Y":
list2.append(x)
if input == "n" or input == "N":
continue
print(list2)
I want to go through list1 and ask if each thing should be added to list2, but I get this error:
example.py 5 <module>
input = input(f"Do you want to add {x} to list 2? [y/n] ")
TypeError:
'str' object is not callable
The error happens when I give a input. Why do I get this error, and what can I do to fix it?