Python Tutorial : CHAPTER 3: Using lists


I think we have experienced how is easy is define variables in Python.
You just have to select the variable name you want to use and then
assign the desired value. In this chapter we are going to see some
examples to have a better comprehension about the definition and used
of variables. Even all the previous operations you have learned can be
used more easily through variables. You can
Use these variables to print lists. Let’s see some examples for this:

>>> a = [‘Barack Obama’,‘Sarah Palin’, ‘Joe Bidden’, John McCain]
[‘Barack Obama’, ‘Sarah Palin’, ‘Joe Bidden’, John McCain]


It prints a complete list. I the next image you will see how to
extract only the elements you want from the list. For instance if you
want only extract the first element it has the position [0] in memory.
If you desire extract the second element you will notice it has the
position [1] and so on and so forth.

You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.