Question: Python 3 5) Define a new function called randomColor() to select and return one of five colors. Put this function above problemFive(), not inside problemFive().
Python 3

5) Define a new function called randomColor() to select and return one of five colors. Put this function above problemFive(), not inside problemFive(). a) Import the random module, place the import at the top of your file. The randomColor() function should use the random.choice() function. You can search for this to see an example online b) In the randomColor() function create a variable colors and assign the following list: ['red', 'white', 'blue', 'green', 'orange', 'pink'] c) In the randomColor() function, use the random.choice() function with the colors variable to pick a random color and assign it to a variable color d) Return the selected color from the randomColor() function e) In your problemFive() function, call the randomColor() function inside a for loop. Have the body of the for loop call the randomColor() function five (5) times. You can use [1,2,3,4,5] or range() with this for loop. Print the returned color from each call to the randomColor() function, one per line
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
