diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2025-03-12 20:47:04 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2025-03-12 20:47:04 -0600 |
| commit | ab0dbb368948becb5beda50a585f9620bc186662 (patch) | |
| tree | db0102a76c74abb4e0cd3a933dbda28e04f9cd6e /tutorials/1_functions.md | |
| parent | f404748a1085af0dabae487f8fedcad20a238d0c (diff) | |
Completed Functions anr Arrays tutorial
Diffstat (limited to 'tutorials/1_functions.md')
| -rw-r--r-- | tutorials/1_functions.md | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tutorials/1_functions.md b/tutorials/1_functions.md index edbd3a2..8235fe3 100644 --- a/tutorials/1_functions.md +++ b/tutorials/1_functions.md @@ -2,7 +2,7 @@ Like a traditional mathematical functions, python functions can take an input, process it, and give an output. In python, the input variables are referred to as *arguments*. Functions are blocks of code that is run every time it's called. This allows us to re-use code. -Functions are defined by using the <code> def </code> keyword. Reminder: it is important to keep track of indentation as it signify the end of the function when the indentation. +Functions are defined by using the <code> def </code> keyword. Reminder: it is important to keep track of indentations as it signifies the end of the function when the indentation returns back to the same level. ## Defining Functions ### Simple function @@ -39,8 +39,15 @@ Now that we've covered defining functions we want to call the function in order function(2,-1) ``` -Note that when running this code, nothing happens. This is because we haven't told the computer to print the result. +Note that when running this code, nothing happens. This is because we haven't told the computer what to do with the output. Hence, if we wish to store the output then we need to use the assign operator `=`. +```python +output = function(2,-1) + +print(output) +``` + +In case you want to return multiple output variable from a single function we will have... ## Summary |
