Question:medium

Identify the statement from the following which will raise an error:

Show Hint

Always ensure that the operands in concatenation operations are of the same data type. Use str() to convert integers to strings if needed.

Updated On: Jan 13, 2026
  • print("A"*3)
     

  • print(5*3)
     

  • print("15" + 3)
     

  • print("15" + "13") 
     

Show Solution

The Correct Option is C

Solution and Explanation

In Python:
  • Option (a): "A"*3 produces the string "AAA" by repeating "A" three times.
  • Option (b): 5*3 results in 15 from integer multiplication.
  • Option (d): "15" + "13" concatenates the strings "15" and "13" to form "1513".
  • Option (c): "15" + 3 raises a TypeError because concatenation of a string ("15") and an integer (3) is not permitted.
Was this answer helpful?
0

Top Questions on Miscellaneous