Random Element Selection Function

  • Share this:

Code introduction


This function randomly selects an element from the provided list and returns it.


Technology Stack : random

Code Type : Function

Code Difficulty : Beginner


                
                    
def random_choice(items):
    import random
    return random.choice(items)                
              
Tags: