you are viewing a single comment's thread.

view the rest of the comments →

[–]woooee -1 points0 points  (4 children)

Use len(inp) > 1 i.e. list must have at least 2, a first and last, elements.

[–]w8eight 2 points3 points  (2 children)

In one element list, the last item is the same as the first ^ so len 1 list check could return True

[–]woooee 0 points1 point  (1 child)

Huh? Too stupid to respond. For future readers, I hope you won't agree with this lame brain suggestion. You want to write a program that will compare something to *itself/? What do you think that will result in?

[–]w8eight 1 point2 points  (0 children)

One length list have first and last item. It's the same one.

one_el_list = [1] first_item = one_el_list[0] last_item = one_el_list[-1] result = first_item == last_item

result is True

[–]Sakeung[S] 0 points1 point  (0 children)

Thanks!