Robotics & Artificial Intelligence
In Python, the keyword used for defining a function is …………..
- func
- function
- def
- import
Answer
def
Reason — In Python, the keyword def is used to define a function. It is followed by the function name and parentheses containing the parameters, ending with a colon. The other options like func and function are not valid Python keywords, while import is used to include modules.
Related Questions
Which of the following statements is the most appropriate for Python function?
- A block of code that only runs when it is called
- A variable used to store data
- A way to print output to the console
- An error message
Which of the following are the two main parts of every function in Python?
- Function header and function body
- Function block and main block
- Function head and function tail
- None of the above
Which of the following statements is not true for a function in Python?
- It is a program module.
- It is reusable piece of a program.
- It is not a program module.
- All of the above
What is the default return value when a function does not return any value explicitly?
- null
- void
- empty
- None