from random import randrange
Sum=0
count=0
L=[] #list that will contain the counts
while True: #infinite loop
while Sum<2:
Sum+=randrange(0,2) #picks a random number from 0 and 1
count+=1 #counts every time it does this until the sum is more than 2
L+=[count] #adds the count to the list
print(sum(L)/len(L)) #prints the average of all the numbers of the list
Sum=0 #
count=0 #resets the sum and count to create more counts