Mastery12

Creating Python functions

A function in Python is a statement that will only be true when you call that function.

For example if carrito=32, you can change that variable defining a function, that way carrito can be 23 now.

As you can see in the image below, I first assigned to carrito the number 32, and then I created a function that will assign the number 23 to that same variable, and will print that variable. In order to call that function, I have to write “nuevocarrito()” and it will do what I defined in that function.

Mastery12

Mastery12

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

Comments are closed.