Learn with Yasir

Share Your Feedback

Fill in the Blanks: Functions in Python


Fill in the Blanks: Functions in Python

  1. A function is a block of ____ code that performs a specific task.
    Answer: reusable

  2. To define a function in Python, use the ____ keyword.
    Answer: def

  3. The ____ statement is used to return a value from a function.
    Answer: return

  4. Parameters are variables declared in a function’s ____, while arguments are the values passed to the function when it is ____.
    Answer: definition, called

  5. A function with default arguments allows you to call the function without providing ____ for those arguments.
    Answer: values

  6. The ____ keyword is used to specify arguments by name when calling a function.
    Answer: keyword

  7. A ____ error occurs when the indentation of a function’s body is incorrect.
    Answer: syntax

  8. The ____ function in Python is used to display output to the console.
    Answer: print

  9. A function can have multiple ____ arguments, each with a default value.
    Answer: optional

  10. The ____ operator is used to multiply two numbers in a function.
    Answer: *

  11. In Python, the ____ keyword is used to define a function that does not return any value.
    Answer: def

  12. The ____ of a rectangle can be calculated using the formula length × width.
    Answer: area

  13. A function can be called multiple times to improve ____ and avoid code repetition.
    Answer: reusability

  14. The ____ function is used to check if a number is even or odd.
    Answer: is_even

  15. In Python, ____ arguments allow you to specify default values for parameters.
    Answer: default

  16. The ____ keyword is used to specify the end of a function definition.
    Answer: colon (:)

  17. A ____ is a string that explains the purpose of a function and is placed immediately after the function definition.
    Answer: docstring

  18. The ____ function in Python is used to take input from the user.
    Answer: input

  19. A ____ is a variable that is passed to a function when it is called.
    Answer: argument

  20. The ____ keyword is used to define a function in Python.
    Answer: def