Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IN PYTHON PLEASE! 1. 2. Write a program that takes as input a number of kilormet

ID: 3748797 • Letter: I

Question

IN PYTHON PLEASE! 1. 2. Write a program that takes as input a number of kilormeters and prints the corresponding number of nautical miles. Light travels at 3 x 10 meters per second. A light-year is the distance a light beam travels in one year. Use the following approximations: Write a program that calculates and displays the value of a light-year . A kilometer represents 1/10,000 of the distance between the North Pole and the equator. Useful facts: . There are 90 degrees Seconds in a year - containing 60 minutes of arc each, between the North Pole and 365x24x602 . Rate = 3x10e meters the equator per second Below is an example of the correct output format . A nautical mile is 1 minute of an arc An example of the program input and output

Explanation / Answer

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts. Thanks

#code for first question

#unit to convert a km to nautical miles

km_to_nm=(1.0/10000.0)*90.0*60.0

#getting input in kilometers

km=float(input('Enter kilometers: '))

#converting km to nm

nm=km*km_to_nm

#printing result

print(km,'kilometers =',nm,'nautical miles')

#code for second question

#units for the conversion

seconds_in_year=365.0*24.0*60.0*60.0

rate=3*pow(10,8)

#getting number of light years

years=float(input('Enter light years: '))

#converting light years to meters

meters=years*seconds_in_year*rate

#displaying the result

print(years,'light years =',meters,' meters')

#output for first question

Enter kilometers: 129.66

129.66 kilometers = 70.0164 nautical miles

#output for second question

Enter light years: 1

1.0 light years = 9460800000000000.0 meters