If we want to create a function in python we only have to do define the function and the parameters.

.Captura de pantalla 2015-10-28 a las 14.43.13

Now that we define the function and the parameters now we have to work with it, we put a for, an if, a while or something that we want in the function, for example I only want the sum of two numbers, I only write return x + y.

Captura de pantalla 2015-10-28 a las 14.57.08

Now to call the function I only write print (The name of the function (the parameters))

Captura de pantalla 2015-10-28 a las 14.57.45

The result of this is

Captura de pantalla 2015-10-28 a las 14.58.26

CC BY 4.0 Mastery 11 & 12 by juanmele97 is licensed under a Creative Commons Attribution 4.0 International License.