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. Exercise: statistics
  42. Exercise: Pascal's triangle
  43. Exercise: Pascal's triangle functions
  44. Exercise: recursive dependency tree
  45. Exercise: dependency tree
  46. Exercise: Tower of Hanoi
  47. Exercise: Merge and Bubble sort
  48. Exercise: Refactor previous solutions to use functions
  49. Exercise: Number guessing - functions
  50. Solution: statistics
  51. Solution: Pascal triangle
  52. Solution: Pascal triangle functions
  53. Solution: recursive
  54. Solution: Tower of Hanoi
  55. Solution: Merge and Bubble sort