Answers for "select a value randomly in a set python"

2

select a value randomly in a set python

import random

# with replacement = same item CAN be chosen more than once.
# without replacement = same item CANNOT be chosen more then once.

# Randomly select 2 elements from set without replacement and return a list
random.sample(set_name, 2)
Posted by: Guest on February-01-2020
23

how to randomly choose from a list python

random.choice(name of list)
Posted by: Guest on December-04-2019

Code answers related to "select a value randomly in a set python"

Python Answers by Framework

Browse Popular Code Answers by Language