t = ['zero', 'one', 'two'] x = t.pop(1) print(t) # ['zero', 'two'] print(x) #pop() can return the element that was removed. # one ---- #If you don’t provide an index, it deletes and returns the last element. t = ['zero', 'one', 'two'] x = t.pop() print(t) # ['zero', 'one'] print(x) # two
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter