Functions are easy ones, you just have to put the name of it, and the parameters, lets say.. the sum of three numbers

def sumas (w,x,y,z):
     suma = w+x+y+z
     print (sumas)

The w,x,y,z are the parameters, basicaly, when you call that function, you have to put those variables in that order

To call ir just type the name of the function, and then its parameters

sumas(1,3,4,2)

You can create them as complex as you wish, just remember the parameters!

There you have it! you’ve just created a function and called it!

There is an example of a little bit more complex:

definingcallingfunctions

That program will take two number, and will call a function named adds, which needs one parameter: X, to state the begining of the multiplications, and a Y, which will be the stop.

And also call a function named fact, which will get the factorial number, it just need the parameters X where x is the number you wish to take the factorial from.

And that is all!

CC BY 4.0 Making life easier: Functions masteries 11, 12 by charliegdrummer is licensed under a Creative Commons Attribution 4.0 International License.