Question
makeColors(colorLst,color) colorLst is a list of strings representing different colors color is a string representing a color Each color in the list is checked with
makeColors(colorLst,color)
colorLst is a list of strings representing different colors
color is a string representing a color
Each color in the list is checked with value of current element of the color string
If color is not the first color listed in the element from color list then a new color is
created concatenating color to the element from the color list
New colors are saved in a new color list
NOTE: makeColors MUST USE checkColor to determine if the color is in the first positions as described in checkColor above.
def checkColor(color1,color2): color1 = color1.upper() color2 = color2.upper() size = len(color1) if color1== color2[:size]: return True else: return False
This is the output in python please
.
>>>makeColorsCC'BLUE',' Red-Green', 'Green-red, 'rEd C'red-blue "red-green-red'] >makeColorsCC' Green', 'Green-blue,' Green-red '1,' grEEn ") CI >>>makeColorsCC' Gred',' C'red-gred', "red-very", "red-blue'] bLUe , 'reDStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started