Which of the following is the correct way to define a function in Python?
- def my_function():
- define_function my_function():
- func my_function():
- function my_function():
The correct way to define a function in Python is as follows: 'def my_function():'. The 'def' keyword is used to define a function, followed by the function name and parentheses.
Loading...
Related Quiz
- Which of the following is true regarding the mutability of tuples in Python?
- Tuples in Python are _______.
- Which of the following is a recommended use case for custom context managers?
- What is the primary use of the Pandas library in Python?
- To iterate over a list and its indices simultaneously, you can use the ____ function.