You will write three small functions about the redshift of galaxies.
The idea. If the observed wavelength is longer than the laboratory wavelength, the light is redshifted, and the galaxy is moving away. For speeds much smaller than the speed of light, .
Your tasks.
speed_from_shift, return the speed in m/s for the laboratory wavelength lab and the observed wavelength observed, both in nm.is_redshifted, return True if the observed wavelength is longer than the laboratory wavelength, and False if not.fastest, return the name of the galaxy that is moving away fastest, from the dictionary galaxies of names and pairs (lab, observed).Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…