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
Ruben is helping his team choose a leader. Of the people Ruben is considering, which one has qualities most related to being an
siniylev [52]

An effective team leader shows great skills in every area, shows great support and respect to his teammates and is very easy to get along with.

5 0
3 years ago
Read 2 more answers
What type of coverage pays for damage incurred as a result of theft, vandalism, fire or natural disaster?
Sloan [31]

Comprehensive or hazard insurance

5 0
3 years ago
Implement the function charCnt. charCnt is passed in a name of a file and a single character (type char). This function should o
SVEN [57.7K]

Answer:

Answered below

Explanation:

//Program is written in Python programming language

def charCnt( fileName, char){

if not fileName.exists( ):

return sys.exit(1)

else:

openFile = open("$fileName.txt", "r")

readFile = openFile.read( )

fileLength = len (readFile)

count = 0

for character in range(fileLength):

if readFile[character] == char:

count++

openFile.close( )

return count

}

7 0
3 years ago
What is the space complexity of the algorithm?ArithmeticSeries(list, listSize) { i = 0 arithmeticSum = 0 while (i &lt; listSize)
blondinia [14]

Answer:

O(n) which is a linear space complexity

Explanation:

Space complexity is the amount of memory space needed for a program code to be executed and return results. Space complexity depends on the input space and the auxiliary space used by the algorithm.

The list or array is an integer array of 'n' items, with the memory size 4*n, which is the memory size of an integer multiplied by the number of items in the list. The listSize,  i, and arithmeticSum are all integers, the memory space is 4(3) = 12. The return statement passes the content of the arithmetic variable to another variable of space 4.

The total space complexity of the algorithm is "4n + 16" which is a linear space complexity.

7 0
3 years ago
Is MS DOS a network operating system?​
chubhunter [2.5K]

Answer:

Operating systems now use networks to make peer-to-peer connections and also connections to servers for access to file systems and print servers. The three most widely used operating systems are MS-DOS, Microsoft Windows and UNIX.

Explanation:

7 0
3 years ago
Other questions:
  • "is it important to have a firewall on a home network
    10·1 answer
  • What command in windows re gives you the opportunity to manage partitions and volumes installed on the system?
    7·1 answer
  • A software programâs _________ indicates what can legally be done with that program.]
    5·1 answer
  • Edhesive 3.2 Lesson Practice question 1
    5·1 answer
  • What is the best kernel synchronization solution on multicore systems when a lock is held for brief periods ?
    14·1 answer
  • The process of adding a header to the data inherited from the layer above is called what option below
    8·1 answer
  • What are wizard ranks in brainly​
    13·2 answers
  • Help please match them if you just put a link or say “I don’t know but thanks for the points” I’ll report your answer and you wo
    10·1 answer
  • ________ is a group meeting-based process for requirements collection. a. Reverse engineering b. Joint application design c. Hum
    9·1 answer
  • Writing queries in sql to compile data from a database is related to the physical level of databases true or false?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!