Random Color Selection Function

  • Share this:

Code introduction


This function returns a randomly selected color.


Technology Stack : random

Code Type : Function

Code Difficulty :


                
                    
import random

def random_color():
    colors = ["red", "green", "blue", "yellow", "purple", "orange", "white", "black"]
    return random.choice(colors)                
              
Tags: