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. Mixing positional and named parameters - order
  7. Default values, optional parameters, optional parameters
  8. Default value in first param
  9. Several defaults, using names
  10. Default list
  11. Arbitrary number of arguments *
  12. Arbitrary number of arguments passing a lists
  13. Arbitrary number of arguments passing a tuple
  14. Fixed parmeters before the others
  15. Pass arbitrary number of functions
  16. Arbitrary key-value pairs in parameters **
  17. Pass a real dictionary
  18. The dictionary contains copy
  19. The dictionary contains copy but NOT deep copy!
  20. Extra key-value pairs in parameters
  21. Extra key-value pairs in parameters for email
  22. Every parameter option
  23. Duplicate declaration of functions (multiple signatures)
  24. Pylint duplicate declaration
  25. Return more than one value
  26. Recursive factorial
  27. Recursive Fibonacci
  28. Non-recursive Fibonacci
  29. Unbound recursion
  30. Set recurions limit
  31. Variable assignment and change - Immutable
  32. Variable assignment and change - Mutable list
  33. Variable assignment and change - Mutabled dict
  34. Parameter passing of functions
  35. Passing references
  36. Function documentation
  37. Sum ARGV
  38. Copy-paste code
  39. Copy-paste code fixed
  40. Copy-paste code further improvement
  41. Palindrome
  42. Exit vs return vs break and continue
  43. Exercise: statistics
  44. Exercise: Pascal's triangle
  45. Exercise: Pascal's triangle functions
  46. Exercise: recursive dependency tree
  47. Exercise: dependency tree
  48. Exercise: Tower of Hanoi
  49. Exercise: Merge and Bubble sort
  50. Exercise: Refactor previous solutions to use functions
  51. Exercise: Number guessing - functions
  52. Solution: statistics
  53. Solution: Pascal triangle
  54. Solution: Pascal triangle functions
  55. Solution: recursive
  56. Solution: Tower of Hanoi
  57. Solution: Merge and Bubble sort