1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
suter [353]
3 years ago
11

Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints i

ts hexadecimal value. Currently, it only supports the three additive primary colors (red, green, blue), so it returns "unknown" for all other colors. m 1 - def color_translator(color): 2. if _== "red": 3 hex_color = "#ff0000" 4- elif == "green": 5 hex_color = "#00ff00" elif == "blue": hex_color = "#0000ff" in 0 hex_color = "unknown" return _ . 12 13 14 15 16 17 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 Run Reset
Computers and Technology
1 answer:
pogonyaev3 years ago
3 0

Answer:

The completed program is

def color_translator(color):

      if color == "red":

             hex_color = "#ff0000"

      elif color == "green":

             hex_color = "#00ff00"

      elif color == "blue":

             hex_color = "#0000ff"

      else:

             hex_color = "unknown"

      return hex_color

Explanation:

Since the parameter in the above function is <em>color,</em>

This variable will serve as the <em>name of a color </em>and it'll be used in the conditional statements to check if the <em>name of color </em>is any of red, green and blue;

And that is why we have

<em>if color == "red":</em>

<em>elif color == "green":</em>

<em>elif color == "blue": </em>

<em />

The variable used to hold the color codes, <em>hex_color, </em>will be returned at the end of the function and that's why we have

<em>return hex_color</em>

<em />

When the program is tested with <em>print(color_translator("blue")) </em>and others, it prints the desired output

You might be interested in
Suppose a group consists of 5 students. Three students are selected at random to do a presentation. How many different sets of p
Klio2033 [76]

Answer:

The number of presentation groups of 3 students that can be selected from a group of 5 students equals 10.

Explanation:

The number of different presenters equals the no of possible combinations of 3 students from a pool of 5 students.

Thus the number of possible combinations equals

\binom{5}{3}=\frac{5!}{(5-3)!\times 3!}=10

6 0
4 years ago
What is the difference between Windows 7 and Windows 10?
Tanzania [10]
Windows 10 is new and windows 7 is old
6 0
3 years ago
CS124 PRATCTICE
Levart [38]

Answer:

b

Explanation:

6 0
3 years ago
Guys please inbox me​
ololo11 [35]

Answer:

how do i do that?

Explanation:

5 0
3 years ago
Read 2 more answers
What is Malware? Discuss this topic and give 3 examples of Malware AS WELL AS a description of how they cause damage to computer
Papessa [141]

Answer:

Definition:

Malware refers to the malicious electronic instructions ( programmes ) which copy and store themselves on the memory of the computer which destroys and halts the working condition of the computer.

Examples:

<em>→</em><em> </em><em>Trojanic</em><em> </em><em>bomb</em><em>.</em>

<em>→</em><em> </em><em>Memory</em><em> </em><em>bomb</em><em>.</em>

<em>→</em><em> </em><em>Polymorphic</em><em> </em><em>bomb</em><em>.</em>

5 0
3 years ago
Other questions:
  • The leading membranophone in "Kan andi ghazal" is the ________. (If you can not access the audio file here, please go to modules
    11·1 answer
  • I NEED SOME MAJOR HELP W/ THIS!!! PLSSS. WHOEVER HELPS GETS 80 POINTS!!! I NEED IT DONE SOON! TYY &lt;3;)
    13·1 answer
  • The Domain Name Service is what translates human-readable domain names into IP addresses that computers and routers understandA.
    11·1 answer
  • A(n) _____ is any hardware component that allows you to enter data and instructions into a computer or mobile device.
    9·1 answer
  • Need help with this
    6·1 answer
  • How many types of sharing of Google Forms are possible?
    15·1 answer
  • Do you think<br> brain uploading<br> is a good idea?
    7·1 answer
  • How can computational thinking techniques be applied to software development
    6·1 answer
  • Please dont delete. my teacher said to see how many people I could meet on here. THIS IS A BIG PART OF MY GRADE!! DO NOT REPORT!
    13·2 answers
  • Identify the characteristics of syntax errors. Choose all that apply.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!