Functions (subroutines)

  1. Why use functions?
  2. Defining simple function
  3. Passing positional parameters to a function
  4. Function parameters can be named
  5. Mixing positional and named parameters
  6. Default values, optional parameters, optional parameters
  7. Default value in first param
  8. Several defaults, using names
  9. Arbitrary number of arguments *
  10. Fixed parmeters before the others
  11. Arbitrary key-value pairs in parameters **
  12. Extra key-value pairs in parameters
  13. Every parameter option
  14. Duplicate declaration of functions (multiple signatures)
  15. Pylint duplicate declaration
  16. Return more than one value
  17. Recursive factorial
  18. Recursive Fibonacci
  19. Non-recursive Fibonacci
  20. Unbound recursion
  21. Variable assignment and change - Immutable
  22. Variable assignment and change - Mutable
  23. Parameter passing of functions
  24. Passing references
  25. Function documentation
  26. Sum ARGV
  27. Copy-paste code
  28. Copy-paste code fixed
  29. Copy-paste code further improvement
  30. Palindrome
  31. Exercise: statistics
  32. Exercise: recursive dependency tree
  33. Exercise: dependency tree
  34. Exercise: Tower of Hanoi
  35. Exercise: Merge and Bubble sort
  36. Exercise: Refactor previous solutions to use functions
  37. Exercise: Number guessing - functions
  38. Solution: statistics
  39. Solution: recursive
  40. Solution: Tower of Hanoi
  41. Solution: Merge and Bubble sort