I'm trying to figure out why this doesn't return the 3rd element.
Input:
t = [(3,300),(1,100),(2,200),(4,400),(5,500)]
t.sort()
print(t)
t = t[0:2]
print(t)
Output:
[(1, 100), (2, 200), (3, 300), (4, 400), (5, 500)]
[(1, 100), (2, 200)]
Thanks! And sorry for the simple question. I would have expected the result to be: [(1, 100), (2, 200),(3,300)]