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