Computer Science, asked by CLARINE554, 9 months ago

Write the output of the following code
#!/usr/bin/py thon
str = " this is string example….wow!!! " print str.lstrip( )
str = "88888888this is string example….wow!!!8888888"
print str.lstrip(‘8’)

Answers

Answered by letmeanswer12
0

The output is:

this is string example....wow!!!

this is string example....wow!!!8888888

Explanation:

Python string method lstrip() is an optimized function that returns a copy of the string in which all characters were stripped from the start of the string (default white space characters).

In the code snippet,

  • str = " this is string example….wow!!! "  
  • print str.lstrip( )

This statement when executed will delete all the leading white space and will return a string 'this is string example....wow!!!'

  • str = "88888888this is string example….wow!!!8888888"
  • print str.lstrip(‘8’)

This statement when executed will delete all the leading char '8' and will return a string 'this is string example....wow!!!8888888'

Similar questions