In this Page, We are Providing Python Programming – Compound statement Functions. Students can visit for more Detail and Explanation of Python Handwritten Notes Pdf.
Python Programming – Compound statement Functions
Functions
The function is a compound statement which returns some value to the caller. The keyword def introduces a function definition. It must be followed by the function name and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line and must be indented.
The first statement of the function body can optionally be a string literal; this string literal is the function’s documentation string, or “docstring”. Docstring is a string literal that appears as the first expression in a class, function, or module. While ignored when the suite is executed, it is recognized by the compiler and put into the doc attribute of the enclosing class, function, or module.
- Python Data Persistence – User Defined Functions
- Python Interview Questions on Introduction to Python
- Python Programming – Scope
>>> def summation ( a , b ) : . . . " " " Gives sum of . . . two numbers " " " . . . sum=a+b . . . return sum >>> summation ( 5 , 10 ) 15 >>> summation. ________ doc_______ ' Gives sum of \ n two numbers '