I am looping through a list of tuples and I want to add a conditional so that if the condition has multiple successes only one of them is chosen with an equal percentage of chance.
In [1]:
junctions = ([1,2], [1,3], [2,3])
roads = ("a", "b", "c", "d")
for a, b in junctions:
if a == 1:
print(roads[b])
Out [1]:
c
d
In this example, I would want it to return either c or d with a 50% chance. Is this possible?