Learning Modules, Arguments, Parameters (imma noob)
codywcox at gmail.com
Fri Sep 25 21:03:43 CEST 2015
#Programming Exercise 1 - Kilometer Converter
#Design a modular program that asks the user to enter a distance in kilometers and then covert it to miles
# Miles = Kilometers * 0.6214
#set the variable to 0.0, makes it a float and creates a place in memory for the variable.
kilo = 0.0
this I am not sure about, I set Kilo=get_input(kilo), but why do I need the argument when
I am going to pass it to convert_to_kilometers? but the program works so I am guessing that is where it is saving
the variable in order to be passed? so it needs to be returned as an argument to be passed as an argument for
the next call???
kilo = get_input(kilo)
kilo =float(input('Enter the amount of Kilometers: '))
miles = kilo * .6214
print(kilo,'Kilometers converts to: ',miles, ' Miles.')
This was a great learning experience trying to understand modules
and how parameters & arguments work together.
Thanks for helping me understand
More information about the Python-list