python get random elements from array code example
Example 1: choose random index from list python
import random # Don't forget to install it first with pip install random
ahahfunny = ['ahah ', 'copy-', 'paste ', 'stack overflow',' go ', 'brrr']
# the biggest index in this list above is 5 (0 being 1 in programming)
print(ahahfunny[random.randint(0, 5)] # I like this way,
print(random.choice(ahahfunny)) # But this way is WAY thiccer...
Example 2: random.choice()
import random
l=[1,2,3,4,5,6,7,8,9,0]
random.choice(l)
print(l);