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...
-
Knowing that you have numerous friends throughout the company, your boss relies on you for feedback concerning employee morale and other issues affecting the staff. She recently asked you to start...
-
You are an Information Systems (IS) expert who works as a freelance consultant, providing advice to Small and Medium Enterprises (SME) with respect to their IT needs. You have been hired by ABC Ltd,...
-
Apply ridge regression to the Hald cement data in Table B.21. a. Use the ridge trace to select an appropriate value of \(k\). Is the final model a good one? b. How much inflation in the residual sum...
-
John Smith has developed the following forecasting model: Y = 36 + 4.3X1 Where Y = Demand for K10 air conditioners X1 = the outside temperature (F) (a) Forecast the demand for K10 when the...
-
M - Shock recently began production of a new product, a smartwatch with a capital investment amounting to RM 1 , 6 0 0 , 0 0 0 . For the first year, the company's target is to earn a net profit equal...
-
Dr. Smith learned that one sorority on campus had purchased several Macintosh computers and another sorority had purchased several Windows-based computers. Dr. Smith was interested in whether the...
-
Conceptual framework or Theoretical framework'? I need help in developing this portion of my proposed dissertation. Which of these is appropriate for research on issues of dementia caregiving...
-
Wilmington Investments, LLC leased a building from Baker Properties, Inc. The sole shareholder of Baker Properties, Inc. is Joe Baker. During Hurricane Louisa, the building was damaged and flooded....
-
When posting from the General Journal to the General Ledger to create an Audit Trail the procedure is done in the following order: _____ Enter the amount from the General Journal. If in the Debit...
-
Some of the major Accounting fields would include the following except: Question 1 Answer a. Summary, analysis and reporting of financial transactions b. Management accounting for employees'...
-
All the items below must be considered when insuring your US medical device manufacturing site which makes class III products is compliant with the FDA QSR for Production and Process Controls:...
-
I scored a 12 out of 12 on the connect assessment. It states range from 10 to 12 you are ready for a career as in HR Professional. Which I will say that I have worked in the area of HR since 2005. So...
-
AH values: Find the AH for the reaction below, given the following reactions and subsequent CaO(s) + SO3(g) CaSO4(s) CaO(s) Ca(s) + O2(g) H2SO4(1) + Ca(s)CaSO4(s) + H2(g) H2SO4(1) HO(1) -> SO3(g) +...
-
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...
-
Two radio stations have the same power output from their antennas. One broadcasts AM at a frequency of \(1000 \mathrm{kHz}\) and one broadcasts FM at a frequency of \(100 \mathrm{MHz}\). Which...
-
A paramecium is covered with motile hairs called cilia that propel it at a speed of \(1 \mathrm{~mm} / \mathrm{s}\). If the paramecium has a volume of \(2 \times 10^{-13} \mathrm{~m}^{3}\) and a...
-
Photon P in Figure Q28.35 moves an electron from energy level \(n=1\) to energy level \(n=3\). The electron jumps down to \(n=2\), emitting photon \(\mathrm{Q}\), and then jumps down to \(n=1\),...
Study smarter with the SolutionInn App