Random Element Selection from List

  • Share this:

Code introduction


This function randomly selects an element from a given list.


Technology Stack : unittest, random

Code Type : Custom function

Code Difficulty : Intermediate


                
                    
import unittest
import random

def random_choice_element_from_list(list):
    return random.choice(list)