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)) print(list[get_index])
Output:
6