summaryrefslogtreecommitdiff
path: root/tutorials
diff options
context:
space:
mode:
Diffstat (limited to 'tutorials')
-rw-r--r--tutorials/3.x_Classes_and_Objects.md7
-rw-r--r--tutorials/3.x_Functions.md29
-rw-r--r--tutorials/readme.md3
3 files changed, 38 insertions, 1 deletions
diff --git a/tutorials/3.x_Classes_and_Objects.md b/tutorials/3.x_Classes_and_Objects.md
new file mode 100644
index 0000000..c25a14f
--- /dev/null
+++ b/tutorials/3.x_Classes_and_Objects.md
@@ -0,0 +1,7 @@
+# Classes and Objects
+
+
+## What are they?
+
+
+## Why do we care?
diff --git a/tutorials/3.x_Functions.md b/tutorials/3.x_Functions.md
new file mode 100644
index 0000000..e4c9874
--- /dev/null
+++ b/tutorials/3.x_Functions.md
@@ -0,0 +1,29 @@
+# Functions
+
+Like a traditional mathematical functions, python functions can take an input, process it, and give an output. Functions are blocks of code that is run everytime 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 indent all code inside the function to signify the end of the function.
+
+## Creating a function with no input
+This is useful if you need to re-use code without having to copy paste the block.
+
+```
+ def function_name():
+ print("This is from a function")
+```
+
+## Creating a function with one input
+
+```
+ def function(x):
+ print(x + " is best")
+```
+
+## Returning values from a function
+Let's make a
+
+```
+ def function(x, b):
+ y = 3*x+b
+ return y
+```
diff --git a/tutorials/readme.md b/tutorials/readme.md
index dfcdbef..64d6451 100644
--- a/tutorials/readme.md
+++ b/tutorials/readme.md
@@ -22,7 +22,8 @@ This directory contains all the tutorials.
- Plotting [Matplotlib]
- Decisions/If conditions
- Loops
-- Functions
+- [3.x_Functions](3.x_Functions.md)
+- [3.x_Classes/Objects](3.x_Classes_and_Objects.md)
### 4.0 Numerical Methods
- Introduction to Numerical Methods