To create a function in Python, you need to write def followed by the name of the function, you can call your function as you want and finally between parentheses the argument of the function.

If you want a function with one argument you will write something like this:


If you want to use two arguments:


If you want to use a function with any argument


And that’s it, keep typing, keep coding.

CC BY 4.0 #Mastery12 by jsphsalazar is licensed under a Creative Commons Attribution 4.0 International License.