What is the purpose of the return statement in a function?
A. It specifies the value to be returned from the function
B. It defines the function's name
C. It ends the execution of the function
D. It prints the result on the screen
Answer: Option C
What does the return statement in a function do?
A. It specifies the value to be returned from the function
B. It ends the execution of the function
C. It prints the result on the screen
D. It defines the function's name
How can you make a parameter optional in a Python function?
A. By using the optional keyword
B. By providing a default value to the parameter
C. By making the parameter lowercase
D. By using a special keyword opt
Which of the following is NOT a valid function name in Python?
A. my_function
B. 2nd_function
C. _function
D. function123
What is the purpose of the def keyword in Python?
A. It is used to define a function
B. It is used to declare a variable
C. It is used to import a module
D. It is used to create a loop
Join The Discussion