Your task is to write a function that calculates the distances (or differences) between a pair of lines in the This Little Piggy rhyme.
Every row in the list data represents one line in the rhyme.
When you run the code, you see that the output of the whole program is a list of lists. When your function works correctly, each list will contain the distances between a single row and all the other rows in data.
Note that the program will compare every row also with itself. In this case – when the compared rows are the same – their distance will be zero.
You can use the function abs(x-y) to calculate the distance between numbers x and y, where x comes from list row1 and y comes from row2.
Your program must work with any text, not only with the rhyme This Little Piggy.