Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
