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, it
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. 1 - def color_translator(color): 2. if == "red": hex_color = "#ff0000" 4. elif _ == "green": hex_color = "#00ff00" elif == "blue": hex_color="#0000ff" 9 hex_color = "unknown" return 11 12 print(color_translator("blue")) # Should be #0000ff 13 print(color_translator("yellow")) # Should be unknown 14 print(color_translator("red")) # Should be #ff0000 15 print(color_translator("black")) # Should be unknown 16 print(color_translator("green")) # Should be #00ff00 17 print(color translator("")) # Should be unknown Run Reset
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
