Advertisements
Advertisements
Question
What are the points to be noted while defining a function?
Short/Brief Note
Advertisements
Solution
- Function blocks begin with the keyword “def ” followed by the function name and parenthesis ( ).
- Any input parameters or arguments should be placed within these parentheses when you define a function.
- The code block always comes after a colon (:) and is indented.
- The statement “return [expression]” exits a function, optionally passing back an expression to the caller. A “return” with no arguments is the same as a return None.
shaalaa.com
Introduction to Python Functions
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
Which function is called anonymous un-named function?
While defining a function which of the following symbol is used.
Read the following statement and choose the correct statement.
In Python, you don’t have to mention the specific data types while defining the function.
Write the different types of functions.
Write a Python code to check whether a given year is a leap year or not.
Explain the different types of functions with an example.
Explain the following built-in function.
id()
Explain the following built-in function.
chr()
Explain the following built-in function.
round()
Explain the following built-in function.
pow()
