Answers for "choose random variable python"

12

how to print a random part of a list in python

import random

foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))
Posted by: Guest on April-08-2020
1

how to make a random variable in python

import random
value = randint(1,10)
#1 and 10 represent the range for your random value
print(value)
Posted by: Guest on March-25-2020

Python Answers by Framework

Browse Popular Code Answers by Language