Answers for "random method from list in python"

5

random from list python

import random

foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))
Posted by: Guest on March-29-2021
0

python random list

import random
randomlist = []
for i in range(0,5):
n = random.randint(1,30)
randomlist.append(n)
print(randomlist)
Posted by: Guest on August-22-2020

Code answers related to "random method from list in python"

Python Answers by Framework

Browse Popular Code Answers by Language