Complete the function by filling in the missing parts. The color_translator function receives the name of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
def colortranslatorcolor if color red hexcolor ff0000 elif color gre... View the full answer
Related Book For
Statistics Unlocking the Power of Data
ISBN: 978-1118583104
1st edition
Authors: Robin H. Lock, Patti Frazer Lock, Kari Lock Morgan, Eric F. Lock, Dennis F. Lock
Posted Date:
Students also viewed these computer network questions
-
Complete each tree diagram by filling in the missing entries (marked with a ?). Case A Case B 0.225 Case C Case I 0.16 0.45 Case II Case A Case B 0.025 Case C 0.025
-
Complete each tree diagram by filling in the missing entries (marked with a ?). 0.09 Case A Case B Case 0.18 Case A Case II Case B 0.45 Case III 0.268 Case A 0.67 Case B
-
Complete each tree diagram by filling in the missing entries (marked with a ?). 0.0598 Case A 0.23 Case B 0.77 0.2002 Case I 0.3268 Case A Case II Case B 0.43 0.24 Case III 0.31 Case A 0.80 Case B...
-
1. differences between debt financing and equity financing 2. accounting differences between preferred stock and common shares. 3. accounting for treasury shares; why do firms want to buy back their...
-
If S = {0,1,2,3,4,5,6,7,8,9} and A = {0,2,4,6,8}, B = {1,3,5,7,9}, C = {2,3,4,5}, and D = {1,6, 7}, list the elements of the sets corresponding to the following events: (a) A U C; (b) A n B; (c) C;...
-
Have you ever gone a step further to decompose these changes into their underlying components (i.e., number of transactions, average spend per transaction, average margin)? How are these components...
-
Air flows past two equal sized spheres (one rough, one smooth) that are attached to the arm of a balance as is indicated in Fig. P9.87. With \(U=0\) the beam is balanced. What is the minimum air...
-
Review the 2007 balance sheet data for Hewlett-Packard (HP) and Dell shown below. 1. Compute each companys current ratio for 2007. Based on the result, which company appears to be more liquid? 2....
-
1-What is the significance of these three matrices regarding their relevance for strategic planning specific for southwest airlines. 2- Describe the key information for each and how information from...
-
Assuming that the switch in Fig. 7.87 has been in position A for a long time and is moved to position B at t =0, find v0 (t) for t ¥ 0. 20 k 12 v (t 30 kS2
-
A bow slides across a violin string that has length 31.2cm and mass 0.195g. The string vibrates at its fundamental frequency to produce the musical note A (440Hz).
-
AutoSave OFF Home Insert m. Paste Page 1 of 2 B Draw Design Layout Calibri (Bo... V 12 I 2 U 611 words ab 2 V A A Aa x A References V English (United States) A Po V Mailings Review V V W Option...
-
For the function f ( x ) equals 3 6 x squared plus 1 2 x plus 1 , a . Calculate the discriminant. b . Determine whether there are 0 , 1 , or 2 real solutions to f ( x ) equals 0 . Question content...
-
You are the CEO and founder of Spectrum Sunglass Company. While you generally feel good about the state of the business, you are beginning to think about your legacy. You are reading more and more...
-
INSTRUCTIONS: We're looking to work with a new publisher that is interested in selling us two different placements. The publisher has told us that placement 1 has an approximate CTR of 0.3% and will...
-
On January 1, 2021, Dell Computer has following balance of accounts: Cash $92,000, inventory $80,000 (80 sets of computers), office equipment 280,000, which can be used for 5 years without residual...
-
Dunkin Donuts is planning to launch a new spinach donut, which will compete with Dunkin's own no-fun donut. Research suggests a cannibalization rate of 32% for the spinach donut. Dunkin earns a...
-
Classify each of the following as direct costs or indirect costs of operating the Pediatrics ward for children at the Cleveland Clinic: a. Wi-Fi covering the entire hospital campus b. Net cost of...
-
(a) The area to the left of the endpoint on a N(5, 2) curve is about 0.10. (b) The area to the right of the endpoint on a N(500, 25) curve is about 0.05. Find endpoint(s) on the given normal density...
-
Give scatterplots of residuals against predicted values. Match each with one of the scatterplots shown in Figure 10.7. 60 - 60 - 50 > 40. > 40- 30 30 : 20 20 8. 10 12 14 16 4 6. 8. 10 12 14 16 (a)...
-
(a) For the study in Exercise 4.139, use StatKey or other technology to create a randomization distribution for these data. Use the distribution to calculate a p-value. Interpret the results. (b) In...
-
Referring to Example 13, conduct a test to show that the mean change \(\mu_{D}\) is different from 0 . Take \(\alpha=0.05\). Data From Example 13 EXAMPLE 13 The chi square test of independence To...
-
A shoe manufacturer wants potential customers to compare two types of shoes, one made of the current PVC material \(X\) and one made of a new PVC material \(Y\). Shoes made of both are available....
-
In a study of the effectiveness of physical exercise in weight reduction, a group of 16 persons engaged in a prescribed program of physical exercise for one month showed the following results: Use...
Study smarter with the SolutionInn App