Answer the question
In order to leave comments, you need to log in
How to replace a random zero with a 1?
import random
b = str(000000)
a = random.randint(1, 6)
Answer the question
In order to leave comments, you need to log in
import random
b=[]
for i in range(6):
b.append('0')
a = random.randint(0, 5)
b[a] = '1'
c=''.join(b)
print(c)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question