Skip to content
Home » Select Random item from Tuple : Python

Select Random item from Tuple : Python

The random.choice() function selects a item from a tuple at random. Use the code below to select a random item from a tuple.

# random.choice() method
import random

# returns random item from the tuple
sam_tuple = (6,8,1,3,0,4)
print(random.choice(sam_tuple))

Output:

1

Also Read:

Select Random element from String : Python