1. Identifying bugs in code

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.

In [ ]:
def stripped_reversed_lowercase(original):
    # Set a breakpoint here and start debugging
    stripped = original.lstrip()
    reversed = ' '.join(reversed(stripped))
    reversed.lower()
    return reversed
In [ ]:
# Let's verify it works
original = ' \n Original String '
result = stripped_reversed_lowercase(original)
assert result == 'gnirts lanigiro'