English

While defining a function in Python, the positional parameters in the function header must always be written after the default parameters. - Computer Science (Python)

Advertisements
Advertisements

Question

While defining a function in Python, the positional parameters in the function header must always be written after the default parameters.

Options

  • True 

  • False

MCQ
True or False

Solution

The statement is False.

Explanation:

In Python, positional parameters must always be written before the default parameters in a function header, not after. Python reads parameters left to right. Once a default value is provided, all the parameters must also have default values — otherwise, it gets confused during function calls.

shaalaa.com
  Is there an error in this question or solution?
2023-2024 (February) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×