.append
Function adds elements to the list.
How can I add elements to the list? In reverse? So that index zero is new value, and the old values move up in index?
What append does
[a,b,c,d,e]
what I would like.
[e,d,c,b,a]
Thank you very much.
Suppose you have a list
a,a = [1, 2, 3]Now suppose you wonder what kinds of things you can do to that list:
Hmmmm… wonder what this
insertthingy does…Insert object before index, you say? Why, that sounds a lot like what I want to do! If I want to insert something at the beginning of the list, that would be before index 0. What object do I want to insert? Let’s try 7…
Well, look at that 7 right at the front of the list!
TL;DR:
dir()will let you see what’s available,help()will show you how it works, and then you can play around with it and see what it does, or Google up some documentation since you now know what the feature you want is called.