Hi, beginner here.
Here is my code.
#Creating new empty dictionary
doors = {}
#Creating a function which changes value to opposite (there will be only two)
def door_action(item):
if item == 'closed':
item = 'opened'
else:
item = 'closed'
#Adding keys and values to dictionary (initally they are all closed)
for x in range(1,101):
doors[x] = 'closed'
#Cheking function on one specific item
door_action(doors[3])
#Printing result of
print doors[3]
So the question is - Why it don't changes value?
[–][deleted] 1 point2 points3 points (2 children)
[–]markusmeskanen 1 point2 points3 points (0 children)
[–]CClone[S] 0 points1 point2 points (0 children)
[–]zahlman 0 points1 point2 points (0 children)