The following stripped_reversed_lowercase
function contains at least one bug. You can see this by running the code in the cell below which tests the functionality of the stripped_reversed_lowercase
function.
Set trace at the beginning of stripped_reversed_lowercase
and use debugger to solve the bug(s). Execute the code line by line and print variables used in the function to understand what's going wrong.
def stripped_reversed_lowercase(original):
# Set a breakpoint here and start debugging
# from IPython.core.debugger import Pdb; Pdb().set_trace()
stripped = original.lstrip()
reversed = " ".join(reversed(stripped))
reversed.lower()
return reversed
# Let's verify it works
original = " \n Original String "
result = stripped_reversed_lowercase(original)
assert result == "gnirts lanigiro"