Pattern: Unexpected keyword argument in function call
Issue: -
Python will raise a TypeError
at runtime if function definition does not expect keyword argument. Modify the function to support keyword arguments or pass the parameter as supported keyword or a positional parameter to resolve this issue.
Example of incorrect code:
def calc_area(width):
return width * 2
calc_area(height = 12)
Example of correct code:
def calc_area(width):
return width * 2
calc_area(width = 12) # passing expected keyword
calc_area(12) # passing positional parameter