getting-started-with-lists/quickref.tex
author amit
Thu, 21 Oct 2010 00:22:42 +0530
changeset 342 588b681e70c6
parent 320 223044cf254f
permissions -rw-r--r--
Added a few large questions and quickrefs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
342
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     1
Creating an list\\
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     2
{\ex \lstinline| empty=[]|}
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     3
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     4
Create a filled list\\
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     5
{\ex \lstinline| nonempty = ['spam', 'eggs', 100, 1.234]  |}
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     6
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     7
Accessing a list\\
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     8
{\ex \lstinline|    nonempty[0] |}
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
     9
{\ex \lstinline|    nonempty[-1] |}
213
6b10318465d4 Added Templates.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
342
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    11
Length of a list\\
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    12
{\ex \lstinline|    len(nonempty) |}
213
6b10318465d4 Added Templates.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
342
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    14
Append an element to a list\\
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    15
{\ex \lstinline|    nonempty.append('python') |}
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    16
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    17
Remove elements of a list\\
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    18
{\ex \lstinline|    del(nonempty[1] |}
588b681e70c6 Added a few large questions and quickrefs
amit
parents: 320
diff changeset
    19
{\ex \lstinline|  nonempty.remove(100) |}