Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Python code to do the following: Create three lists called stars, absmags , and distances containing Now create a new list, appmags, containing apparent

Write Python code to do the following:
Create three lists called stars, absmags, and distances containing
Now create a new list, appmags, containing apparent magnitudes m calculated
using
m=M+5(logd-1)
where M is the absolute magnitude and d is the distance in parsecs. Note that
the logarithm is base-10, so use the log10 function from the math module.
Iterate over the stars, printing for each star "The apparent magnitude of (star) is
(appmag)."
Practice with dictionaries by creating a dictionary for one of the stars. The keys
should be 'm','M', and 'd', and the values should be the apparent magnitude and
so on as appropriate.
Now use the data in the four lists to create a nested dictionary called stardict.
Each dictionary entry should have as its key the name of a star, and the value
should be itself a dictionary like the one you created in #4 above.
Print stardict ['Rigel']['m'].
image text in transcribed

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

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions

Question

help asp

Answered: 1 week ago