Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write two functions called wavelength_to_color() and frequency_to_color() that ask the user for a unit (use input() to get the unit in nm or THz) either

image text in transcribed

Write two functions called wavelength_to_color() and frequency_to_color() that ask the user for a unit (use input() to get the unit in nm or THz) either nanometer ('nm') or terahertz ('THz') and a value (a number). The code should print out the color of the light with that unit and value. Ex: if the user enters THz 487, the output should be that the light with that frequency is orange. If the user enters nm 392, the output should be that the light with that wavelength is purple. Assume that the user always enters valid values. Color Violet Blue Cyan Green Yellow Orange Red Wavelength 380- 450 nm 450-485 nm 485-500 nm 500-565 nm 565-590 nm 590-625 nm 625 - 740 nm Frequency 680-790 THz 620-680 THz 600-620 THz 530-600 THz 510-530 THz 480-510 THz 405-460 THz

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions