Computer Science
Which of the following is not a Python legal string operation?
- 'abc' + 'abc'
- 'abc' *3
- 'abc' + 3
- '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
2 Likes
Related Questions
Multiple line string created with the help of triple quotes will include end line character in the length.
A string is a mutable sequence of one or more characters.
In Python string, + and * represent which of the following operations?
- Concatenation, Replication
- Addition, Multiplication
- Neither (i) nor (ii)
- Both (i) and (ii)
Which of following is not a valid string operation?
- Slicing
- Concatenation
- Repetition
- Floor