Shogun Method Derek Rake
Shogun Method Derek Rake
Lists
Lists are an ordered collection of objects
>>> data = []
>>> print data
Make an empty list
[]
>>> data.append("Hello!") “append” == “add to the end”
>>> print data
['Hello!']
>>> data.append(5) You can put different objects in
>>> print data
the same list
['Hello!', 5]
>>> data.append([9, 8, 7])
>>> print data
['Hello!', 5, [9, 8, 7]]
>>> data.extend([4, 5, 6]) “extend” appends each
>>> print data element of the new
['Hello!', 5, [9, 8, 7], 4, 5, 6] list to the old one
>>>
Lists and strings are similar
Strings Lists
>>> s = "ATCG" >>> L = ["adenine", "thymine", "cytosine",
>>> print s[0] "guanine"]
restriction_sites = [
"GAATTC", # EcoRI
"GGATCC", # BamHI
"AAGCTT", # HindIII
]