Answered step by step
Verified Expert Solution
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 calculated
using
where is the absolute magnitude and is the distance in parsecs. Note that
the logarithm is base so use the log 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 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 # above.
Print stardict Rigelm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started