1. Home
  2. Data Science
  3. Python
  4. What is the output of print('xxhello'.lstrip('x')) in…

Added 25 Nov 2026

What is the output of print('xxhello'.lstrip('x')) in Python?

print('xxhello'.lstrip('x'))
  1. hello Correct answer
  2. helo
  3. olleh
  4. Error

Correct answer

A. hello

MCQSEXAM

Explanation

lstrip with arguments removes characters from the left only.

Reference

Asked in: Python Interview Strings

https://docs.python.org/3/library/stdtypes.html#string-methods

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs