Wow. Yes that code could be improved, a lot. def means declare function. Simply put, it basically creates a variable that, when called, will execute instructions.
The body of the function is not executed until the function is called.
You can read more about functions here:
http://docs.python.org/release/1.5.1p1/t...tions.html
and here:
http://www.tutorialspoint.com/python/pyt...ctions.htm
PHP Code
<?php
def hi(): #Creates a function under the name "hi"
print "Hello World" #This is where the body of the functin is (the instructions executed)
hi() #This is the function call, and when this is called, all the instructions within the function body will be executed successively
The body of the function is not executed until the function is called.
You can read more about functions here:
http://docs.python.org/release/1.5.1p1/t...tions.html
and here:
http://www.tutorialspoint.com/python/pyt...ctions.htm
