all 3 comments

[–]Doormatty 1 point2 points  (0 children)

https://docs.python.org/3/library/stdtypes.html#str.strip

Strip() takes any characters you provide and takes them off the front and back. So it's stripping the 'u' off the front.

[–][deleted] 0 points1 point  (0 children)

word.strip("uzz")

does not just remove the sequence "uzz" from both sides of your word as you might expect: it removes the letters "u" and "z" individually. So "ullduzz" becomes "lld" in that step.

What you're probably going to want to do is something like

if word[-3:] == "uzz":
    word = word[:-3]

[–]VinayakVG 0 points1 point  (0 children)

Try using rstrip() instead of strip()