Question:medium

Identify the invalid Python statement out of the following options:

Show Hint

In Python function calls,
positional arguments must always come before keyword arguments.
Mixing the order causes a syntax error.
Updated On: Jan 14, 2026
  • print("A", 10, end="*")
  • print("A", sep="*", 10)
  • print("A", 10, sep="*")
  • print("A"*10)
Show Solution

The Correct Option is B

Solution and Explanation

The print() function in Python outputs objects to standard output.
Its syntax supports multiple positional arguments before keyword arguments.
Key keyword arguments are sep (separator) and end (line ending).
Option (A) is valid: it prints `"A"` and `10` with end="*" modifying the line termination.
Option (C) is valid: it prints `"A"` and `10` with sep="*" inserted between them.
Option (D) is valid: `"A"*10` results in `"AAAAAAAAAA"`, which is permissible.
Option (B) is invalid because it places a positional argument after a keyword argument.
In Python, positional arguments must precede keyword arguments; any positional argument following a keyword argument will trigger a SyntaxError.
Consequently, option (B) is the invalid statement.
Was this answer helpful?
0