Computer Science

Which of the following is not a Python legal string operation?

  1. 'abc' + 'abc'
  2. 'abc' *3
  3. 'abc' + 3
  4. 'abc'.lower()

Python String Manipulation

3 Likes

Answer

'abc' + 3

Reason — 'abc' + 3 is not a legal string operation in Python. The operands of + operator should be both string or both numeric. Here one operand is string and other is numeric. This is not allowed in Python.

Answered By

3 Likes


Related Questions