Common Computer Science References
At the end of this lesson, you will be able to:
understand and create your own function, with no parameters
main() function
go over Understanding Functions , Computer Based Problem Solving
note: in python it is now standard to include type hints
nil
create a program that has a function called nautical_miles() (or nauticalMiles();) this function lets you enter in a distance in Nautical Miles (Admiralty) and it then prints out what that distance is in kilometers and display the answer in the console; all the functionality needs to be written inside the function, not in main(); main() will just call the function nautical_miles() (or nauticalMiles();)
see here for an explanation and formula
we will use the conversion value: K = NM * 1.853184
you will still have a main() function, but now it will call the other function
for today, NO try ... catch inside your new function
we will assume everyone will enter the correct info!
ensure you can accept a decimal (float) number and your output is also a decimal rounded to 3 decimal places
flowcharts are only for each of the functions, not the main() function
recreate the same above program in C
NOTE: You can turn on "Closed Captions" to see a printout of what is being said by selecting the "CC" button.
You can also have it translate the closed captions by going to "Settings, Subtitles/CC, Auto-translate" and then pick your prefered language.