+ 1
How do make something random?
5 Antworten
+ 2
import random
print(random.randint(1,5))
that returns a random number between 1 and 5.
list=["A", "B", "C"]
random.choice(list)
that will pull a random element from a list
+ 1
Thanks
+ 1
no problem. check my codes, I have a bunch of python. steal whatever
+ 1
by the way, in my example I named my list "list" .. don't do that.
another tip, don't name a file random.py.. screws up random. learned that the hard way
0
Check my codes ;)