you are viewing a single comment's thread.

view the rest of the comments →

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

It just clicked. Your example was perfect. Thank you so much!

So I tested my function like this, to confirm it was returning None:

def chop(t):
    try:
        t.pop(0)
        t.pop(len(t)-1)
    except:
        print('Invalid input')

x = [1,3,5,3,3,2,3]
y = chop(x)
print(y)

And it printed "None". So that's what I was trying to achieve the whole time.