Question: Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints its hexadecimal value. Currently,
Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints its hexadecimal value. Currently, it only supports the three additive primary colors (red, green, blue), so it returns "unknown" for all other colors. def color_translator(color): if "red": hex_color = "#ff0000" "green": 3 elif == hex_color "#00ff00" elif "blue": %3D%3D 7 hex_color "#0000ff" 9. hex_color "unknown" 10 return 11 print(color_translator("blue")) # Should be #0000ff print(color_translator ("yellow")) # Should be unknown print(color_translator("red")) # Should be #ff0000 print(color_translator("black")) # Should be unknown print(color_translator("green")) # Should be #00ff00 print(color translator("")) # Should be unknown 12 13 14 Run 15 16 Reset 17
Step by Step Solution
3.39 Rating (155 Votes )
There are 3 Steps involved in it
def colortranslatorcolor if color red hexcolor ff0000 elif color gre... View full answer
Get step-by-step solutions from verified subject matter experts
