Not sure how else to word the title, but this is what I need:
Print either the number zero, the number one or a phrase in no consecutive order twenty times. This is what I have:
n = 0
x = “hello”
for i in range(20):
print(n, end= ‘’) or print(n+1, end= ‘’) or print(x)
The only problem is that it prints them out in order so that it is always 01hello01hello01hello and so on. I need it to be randomized so that it could print something like 000hello1hello101 or just any random variation of the three variables.
Let me know how :)
import random
choices = [1, 0, "hello"]
for i in range(20):
print(random.choice(choices))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With