Random Element Selection from List

  • Share this:

Code introduction


Selects and returns a random element from the given list.


Technology Stack : random

Code Type : Function

Code Difficulty : Intermediate


                
                    
def get_random_element_from_list(lst):
    import random
    return random.choice(lst)                
              
Tags: