November 2017
Beginner to intermediate
204 pages
5h 23m
English
If you look at the previous example, you might notice that the if statement inside the function doesn't really do much. According to the function, the value of the isSunny variable is always True. Ideally, the reactToTheWeather function should be able to change its behavior based on some outside information, specifically whether or not it is sunny.
When calling a function, it is possible to pass in values called arguments or parameters from outside the function. The names of the arguments that should be made available to the function are written using the following syntax:
def <function name>(<argument1>,<argument2>,<argument3>): <code block><function name>(<value1>,<value2>,<value3>)
When the function is called, ...
Read now
Unlock full access