Last answered:

13 Jun 2024

Posted on:

11 Jun 2024

0

about STRIPPING

s4 = ' quaterly earninng report  '
s5 = s4.split()
so now s5 will be 
'quaterly earninng report'
without  white spaces in the start and the end
s5.strip('quaterly')
it shows an unusual result of 
' earninng repo'


i dont know why!


1 answers ( 0 marked as helpful)
Instructor
Posted on:

13 Jun 2024

0

Hi Anouksha,

Most likely the strip('quaterly') method removes all characters that appear in the word "quaterly" from both the beginning and the end of the string. This results in the unexpected output ' earninng repo' because it strips away 'q', 'u', 'a', 't', 'e', 'r', 'l', and 'y' from both ends of the string, not just the whole word "quaterly"

Hope this helps!

Best,

Ned

Submit an answer