To get a list of indices where a 0 value is located:

```
zeropos = [ idx for idx, val in enumerate(examplelist) if val == 0
# result is [0, 3, 4]
```

If you know that a list contains a certain element, then you can find it's position with index()

example:

```
examplelist = [0,2,1,0,0]
examplelist.index(1)
>>> 2
```

so to set the value to 0:

```
examplelist[examplelist.index(1)] = 0
```

having the list zeropos and using the module random you can now randomly set one of these positions to 1:

```
import random
# get a random choize out of the positions containing zero
pos_to_change = random.choice(zerpos)
# now set this value to 1
examplelist[pos_to_change] = 1
```

Complete solution (if I understood well):

```
import random
def find_one_and_move_to_a_zero(alist):
""" function moving a 1 value to a random zero value of the list """
# find 1 position
one_pos = alist.index(1)
# find 0 positions
zero_pos_lst = [ idx for idx, val in enumerate(alist) if val == 0 ]
# clear 1
alist[one_pos] = 0
# determine random 0 entry
chosen_zero_pos = random.choice(zero_pos_lst)
# set one value
alist[chosen_zero_pos] = 1
example_list = [2,0,0,2,1]
print("Before %r" % example_list)
find_one_and_move_to_a_zero(example_list)
print("After %r" % example_list)
```

Attention. The given solution will change the list. If you want to keep the original list unmodified, then this is also possible with two minor modifications. the function has to create a copy of the initial list and return it as result. If this is required I can show you