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
Write a function called word_count that takes a string and returns a dictionary that maps every case-insensitive word in the str
Taya2010 [7]

Solution :

We need to write a function named ''$\text{word}$_$\text{count}$". The program takes a string and then returns a dictionary which maps the case insensitive word.

def $\text{word}$_$\text{count}$(s):

   $\text{words}$ = $\text{s.lower}$().split()

   $\text{result}$ = {}

   for $x$ in words:

       if $x$ in $\text{result}$.keys():

           $\text{result}$[x] += 1

       else:

           $\text{result}$[x] = 1

   return $\text{result}$

5 0
3 years ago
Suppose that you are given the following partial data segment, which starts at address 0x0700 : .data idArray DWORD 1800, 1719,
Digiron [165]

Answer:

The value EAX contain after the code has been executed is 1233

Explanation:

Solution

Now,

The below instruction describes the MOV operation.

The MOV esi, OFFSET idArray .

It shows the movement, the offset value of the idArray in the esi.

Thus,

Follow the below instruction

MOV eax, [esi+7*TYPE idArray]

It will move the address of the idArray at that position into eax.

Value at the 7th position is moved to eax.

Therefore, the value at eax will be 1233.

5 0
4 years ago
_________ is the biggest problem you can face if you don’t identify the scope of your risk management project. Scope creep Nonco
mart [117]

Answer: Scope creep

Explanation:

 Scope creep in the project management basically refers to the uncontrolled development or growth in the project creep. It basically occur when the project scope are not appropriately defined.

It usually involve lack of change in the control system and increase the complexity of the project. It is also has poor requirement analysis.

So, that is why it is the biggest problem we usually face in the project management.

5 0
3 years ago
1.1. (30 points) Write a program to calculate the average number of cars sold by a car agency over a period of years for the fir
mario62 [17]

Answer:

count = 0

months = 0

years = int(input("Enter the number of years: "))

for year in range(1, years+1):

   cars_sold = int(input("Enter the number of cars sold in first six months: "))

   count += cars_sold

   months += 6

print("Number of months: " + str(months))

print("Number of cars sold in total: " + str(count))

print("Average number of cars sold per month: " + str(count / months))

Explanation:

Initialize the variables

Ask the user for the number of years

Create a for loop that iterates depending on the given number of years

Ask the user for the number of cars sold in the first six months of the year

Increment the count by given number and increment the months by 6 after each iteration

Print the months, count and, average

8 0
3 years ago
Communication mode which supports data in both directions at the same time is called
xeze [42]

Answer:

duplex mode

Explanation:

It is the duplex mode. In this mode, communication is in both directions at the same time. And it is different from the simplex or the semi duplex types in which the communication is one way only or one way at a time only. Thus, duplex mode seems to be requiring more bandwidth certainly but it can be advantageous definitely, and in situations like real tine communication, when we don't have the time and want to send as well receive the message at the same time.

7 0
3 years ago
Other questions:
  • In presentation software, what is the area that displays behind the information you place on a slide?
    5·1 answer
  • The superintendent forbade the students to bring their books and copies in the exam hall. (into direct speech)​
    10·1 answer
  • The feedforward part of the conversation should do all of the following except __________.a.identify the toneb.introduce the pur
    11·1 answer
  • Hi weegy, what is the latest android os?
    9·1 answer
  • What are the opportunities, and challenges, forged by digital transformation?
    13·1 answer
  • Find the smallest value of n such that LCM of n is 15 is 45​
    5·1 answer
  • Hooollaaaa , todos absolutamente todos quieren borrar esta tarea por que no tiene nada que ver con la materias del colegiooo per
    7·2 answers
  • 5 disadvantage of assembly<br> level language​
    12·1 answer
  • Which operating system is used by most the supercomputer system in the world
    9·1 answer
  • Write common ICT tools​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!