If the data is read 3 times in a row, then the next data changes value by 20 data – Python

  list, python, python-3.x

I want to make a change if the randomList data produces a value of 0 three times in a row and then it will change the randomList value to 1 for the next 20 data and here’s an example of a random program that I made.

import random
randomlist = []
for i in range(0,100):
    n = random.randint(1,20)
    if n > 10 :
        randomlist.append('0')
    else :
        randomlist.append('1')
    
print(randomlist)

Source: Python-3x Questions

LEAVE A COMMENT