Python – A little bit about lists and operations with them

Python’s lists are powerful. Especially, if you come from the VBA world its like switching to a new car after years of using the old red Ikarus. Thus, I have decided to write a small article about them, just to be handy for me or for someone else, looking for a good place with references.

python-logo-master-v3-TM

What can you do with the Python lists?

The Python language enables you to do the following operations without including additional libraries:

  • Extend
  • Append
  • Insert
  • Remove
  • Clear
  • Index
  • Count
  • Sort
  • Reverse

How are the done? Pretty much, see the code and the output and you would get it. There is one thing to note – the function List.pop([i]) does two things – if it is assigned to a variable, it returns the popped variable and it removes it from the list. Sounds great, eh?

Check out the code:

This is the output of the code:

Enjoy it! 😀

About

A VBA Developer.

Tagged with: , , , ,