Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to use the random module in python

import random #imports random module which is built-in
random_fruits = ['apple', 'mango', 'banana'] #make a list of fruits and store it in the variable
print(random.choice(random_fruits)) #print fruits randomly
 
PREVIOUS NEXT
Tagged: #random #module #python
ADD COMMENT
Topic
Name
2+2 =