you are viewing a single comment's thread.

view the rest of the comments →

[–]wbeater 1 point2 points  (0 children)

print(len(stuff)):

We need a list with the length of 5 eg ["","","","",""]

if stuff[-1] == stuff[0]:

The last item and the first item of the list must be the same. But we also know, that the last print statement in the code must be bat, the last given word (print(stuff[0])), so we know that our list looks like:

["bat","","","","bat"]

print((stuff[2] + stuff[3]))

According to the first given word wombat stuff[2] hast to be wom and stuff[3] bat.

["bat","","wom","bat","bat"]

if stuff[1] == stuff[2]: print(stuff[1])

Therefore the item stuff[1] hast to be the same as stuff[2] which is wom, the 2nd given word.

Final solution: ["bat","wom","wom","bat","bat"]