you have indentation issues in your code. Indentation is very important in python ! for example, when creating a function, you need an indent, like this :
def func(x,y):
s = x+y
return s
read this , it will help you understand and fix your code:
http://www.diveintopython.net/getting_to_know_python/indenting_code.html