Python Program to Check if given colors are present in the color palate

 Shekhar is an artist. He likes to draw and paint. He is now drawing a portrait of a city road which is in the black color and white strips on it. Check whether both of these colors are present in the color palate.


Input
Space separated string of color names

Output
True or False

Example
Input
green blue white black pink

Output
True

Input
green blue black pink

Output
False

Code:

colors=input().split()
roadColors=["white","black"]
colorlist=[]
for i in colors:
    if i=="white" or i=="black":
        if i not in colorlist:
            colorlist.append(i)
roadColors.sort()
colorlist.sort()
if roadColors==colorlist:
    print(True)
else:
    print(False)

Comments

Popular posts from this blog

CODING ASSIGNMENT 4

CODING PRACTICE 11 Music Page

CODING ASSIGNMENT 3