Home | | Computer Science 12th Std | Python Functions: Points to remember

Chapter: 12th Computer Science : Chapter 7 : Core Python : Python Functions

Python Functions: Points to remember

Functions are named blocks of code that are designed to do one specific job.

Points to remember:

·        Functions are named blocks of code that are designed to do one specific job.

·        Types of Functions are User defined, Built-in, lambda and recursion.

·        Function blocks begin with the keyword “def” followed by function name and parenthesis ().

·        A “return” with no arguments is the same as return None. Return statement is optional in python.

·        In Python, statements in a block should begin with indentation.

·        A block within a block is called nested block.

·        Arguments are used to call a function and there are primarily 4 types of functions that one can use: Required arguments, Keyword arguments, Default arguments and Variable-length arguments.

·        Required arguments are the arguments passed to a function in correct positional order.

·        Keyword arguments will invoke the function after the parameters are recognized by their parameter names.

·        A Python function allows us to give the default values for parameters in the function definition. We call it as Default argument.

·        Variable-Length arguments are not specified in the function’s definition and an asterisk (*) is used to define such arguments.

·        Anonymous Function is a function that is defined without a name.

·        Scope of variable refers to the part of the program, where it is accessible, i.e., area where you can refer (use) it.

·        The value returned by a function may be used as an argument for another function in a nested manner. This is called composition.

·        A function which calls itself is known as recursion. Recursion works like a loop but sometimes it makes more sense to use recursion than loop.

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
12th Computer Science : Chapter 7 : Core Python : Python Functions : Python Functions: Points to remember |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.