Randomly Select Element From List in Python Using randrange()

(Last Updated On: 03/03/2023)

Python Program to Randomly Select Element From List Using randrange()

#Randomly Select an Element From the List using randrange() in python

import random
list = [1, 2, 3, 4, 5, 6, 7, 8, 9]

# Here  using the random randrange() function to return a single random number from a list.
get_index = random.randrange(len(list))




Leave a Reply

Your email address will not be published. Required fields are marked *