Am actually a total noob and therefore it is good if you feel the need to prefix with the disclaimer.
I can see in the libraries, we have randoms that can generate random numbers, but for me I wanted to have jus t a single button that can do the printing of a Yes or a No. which is the best and easy wat that we should use to solve this?
Random words; rather than random number
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Random words; rather than random number
Code: Select all
import random
a = ['Yes', 'No']
for _ in range(10):
print(a[random.getrandbits(1)])
Code: Select all
Yes
Yes
No
Yes
Yes
No
No
No
Yes
No
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.