Random Element Selection from List

  • Share this:

Code introduction


This function takes a list as an argument and returns a random element from the list.


Technology Stack : random

Code Type : Python Function

Code Difficulty : Intermediate


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