What is the purpose of the global keyword do when used in a function?
A. It allows a variable to be modified outside the current scope
B. It defines a new variable
C. It defines a function
D. It imports a module
Answer: Option A
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