Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

random.choices in python

import random
s = ['Apple', 'Orange', 'Banana']

# print any random value from the list s
print(random.choice(s)) # output 'Apple'

# type of value does not matter
s = ['Apple', 'Orange', 'Banana', 13, 3, 1.513, 5413, '1341']
print(random.choice(s)) # output: 1.513
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
2+7 =