I have a dictionary where the value is a variable. When I update the dictionary based on some condition, the 'dictionary element' is updated, but not the referred variable
My code is something like
my_bool = True
my_count_dictionary={'name': my_bool}
my_count_dictionary['name'] = not my_count_dictionary['name'] #Need to toggle it
print (my_count_dictionary['name'])
print (my_count)
I am expecting the output like
False
False
but i am getting
False
True
The original variable is still not updated. I am from C background. I guess i am expecting something like a reference here. Is it possible in python?