In: Computer Science
In each of the projects that follow, you should write a program that contains an introductory docstring. This documentation should describe what the program will do (analysis) and how it will do it (design the program in the form of a pseudocode algorithm). Include suitable prompts for all inputs, and label all outputs appropri- ately. After you have coded a program, be sure to test it with a reasonable set of legitimate inputs.
Q. Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the following approximations: - A kilometer represents 1/10,000 of the distance between the North Pole and the equator. - There are 90 degrees, containing 60 minutes of arc each, between the North Pole and the equator. - A nautical mile is 1 minute of an arc.
*please use IDLE( python 3.7)
SOURCE CODE: *Please follow the comments to better understand the code. **Please look at the Screenshot below and use this code to copy-paste. ***The code in the below screenshot is neatly indented for better understanding. def km_to_nautical_miles(kilometers): """ THIS METHOD WILL TAKE THE kilometers PARAMETER AND CALCULATE THE NAUTICAL MILES OF THE KILOMETERS as kilometers*(5400/10000) :param kilometers:A float value that represents the number of kilometers :return: The calculated nautical_miles value """ nautical_miles = kilometers nautical_miles /= 10000 ## North Pole and Equator distance in Kilometers nautical_miles *= 90 ## 90 degrees between North Pole and Equator nautical_miles *= 60 ## 60 minutes of arc per degree return nautical_miles km = float(input("Number of kilometers: ")) num_nautical_miles = km_to_nautical_miles(km) print(km, 'kilometers is equal to ', num_nautical_miles, " nautical miles")
=======================
SCREENSHOT: