Below you’ll see the code I began with yesterday.  

 

def countSubStringMatchRecursive(target, key, x):
x = find(target, key, x)
if x == -1:
return 0
else:
return countSubStringMatchRecursive(target, key, x+1) +1

target = ["atgacatgcacaagtatgcat", "atgaatgcatggatgtaaatgcag"]
key = ["a", "atg", "atgc", "atgca"]

for t in target:
for k in key:
print  "There were " + str(countSubStringMatchRecursive(t, k, 0)) + " occurances of your key " + k + " in " + t

 


Highlighted in yellow is what are called ‘lists’.  Lists are good for collecting and manipulating data.  There are TONS of ways to interact with lists, you can view more at python.org.  We all like them, lists are very usable in everyday life.  However in order to interact with them in Python there are many different options given.


One of the interesting things about lists is the fact that you can manipulate them.  In other words, you can adjust what’s inside them. There are other things that are not mutable (changeable), such as tuples.  


Above I have two lists; target, and key.  Lists in python can be written with this syntax.  The name is placed on the left, then an equals sign (also known as the assignment), brackets and then each item in the list is separated with a comma.  


 

listname = [item1, item2, item3]

 


The only difference you might see from my code above, and the list just given, is the “” around the information.  Those “” indicate that it’s a string, versus an integer (or int).  A string is anything that shouldn’t be treated like a number (as in mathematically).  If you want to make sure that your number is treated like a word, so that you can’t accidentally add it to something, you put “” around it.  

Tomorrow more of an explanation regarding the last part of the code.  Then a review of what it’s actually meant to do (for those of you wondering).