def example(): #This defines it print("Example.") #This is the defined commands example() #And this is the commands being run
def name_function(parameter list): instruction block
def myFunction(): print('I am running in a function!')
def function(): print('This is a basic function') function() // Returns 'This is a basic function' def add(numA, numB): print(numA+numB) add(1,2) // Returns 3 def define(value): return value example = define('Lorem ipsum') print(example) // Returns 'Lorem ipsum'
def functionName(variable): //function content
def nameOfFunction(something): return something
def my_function(fname, lname): print(fname + " " + lname) my_function("Emil", "Refsnes")
x ="world" def myfunc(): global x x ="hello" myfunc() print(x)
for i in range(3): scores = int(input("Enter scores: ") test = scores / 3 print "Total average grade: " + str(test)