Functions - CBSE Class 12 Computer Science Notes, Diagrams and Solved Questions

Built-in, module and user-defined functions; writing functions with parameters, default and positional arguments; returning one or many values; flow of execution and local versus global scope.

In this chapter

  • Why functions help, and built-in, module and user-defined functions
  • Defining and calling a function with def
  • Parameters and arguments, positional and default parameters
  • Returning a value, returning several values, and None
  • Flow of execution: how control jumps in and out of a function
  • Local and global scope, and the global keyword
  • Writing exam-style functions: prime, factorial, search, counts