I'm new in programming, and am finding a way (if any) to toggle the elements in a list.
I have a list where the elements can be either 1 or 0. I want to toggle them went I give a particular input.
I tried the following way:
i = input('Enter something: ')
check_var_list = ['1', '1', '0']
if i == 'Particular input':
for element in check_var_list:
if int(element) == 0:
element = 1
elif int(element) == 1:
element = 0
But printing this is just print a copy of the original list.
How do I toggle them? Is there a function for that?
I am on Python 3.8.