consensus.py
· 181 B · Python
Raw
import random
x = 0
v = "0"
int1 = 1
int2 = 2
random.seed()
while x != 1000:
v = v + str(random.randint(int1,int2))
x += 1
vlist = list(v)
print max(set(vlist), key=vlist.count)
| 1 | import random |
| 2 | x = 0 |
| 3 | v = "0" |
| 4 | int1 = 1 |
| 5 | int2 = 2 |
| 6 | random.seed() |
| 7 | while x != 1000: |
| 8 | v = v + str(random.randint(int1,int2)) |
| 9 | x += 1 |
| 10 | vlist = list(v) |
| 11 | print max(set(vlist), key=vlist.count) |