Functions (subroutines)
- Why use functions?
- Defining simple function
- Passing positional parameters to a function
- Function parameters can be named
- Mixing positional and named parameters
- Mixing positional and named parameters - order
- Default values, optional parameters, optional parameters
- Default value in first param
- Several defaults, using names
- Arbitrary number of arguments *
- Arbitrary number of arguments passing a lists
- Arbitrary number of arguments passing a tuple
- Fixed parmeters before the others
- Pass arbitrary number of functions
- Arbitrary key-value pairs in parameters **
- Pass a real dictionary
- The dictionary contains copy
- The dictionary contains copy but NOT deep copy!
- Extra key-value pairs in parameters
- Extra key-value pairs in parameters for email
- Every parameter option
- Duplicate declaration of functions (multiple signatures)
- Pylint duplicate declaration
- Return more than one value
- Recursive factorial
- Recursive Fibonacci
- Non-recursive Fibonacci
- Unbound recursion
- Set recurions limit
- Variable assignment and change - Immutable
- Variable assignment and change - Mutable list
- Variable assignment and change - Mutabled dict
- Parameter passing of functions
- Passing references
- Function documentation
- Sum ARGV
- Copy-paste code
- Copy-paste code fixed
- Copy-paste code further improvement
- Palindrome
- Exit vs return vs break and continue
- Exercise: statistics
- Exercise: Pascal's triangle
- Exercise: Pascal's triangle functions
- Exercise: recursive dependency tree
- Exercise: dependency tree
- Exercise: Tower of Hanoi
- Exercise: Merge and Bubble sort
- Exercise: Refactor previous solutions to use functions
- Exercise: Number guessing - functions
- Solution: statistics
- Solution: Pascal triangle
- Solution: Pascal triangle functions
- Solution: recursive
- Solution: Tower of Hanoi
- Solution: Merge and Bubble sort