Python Function Example

The following code is an example of a function that adds two numbers:

#Add is a function that Adds two numbers
def Add(a,b):
     result=a+b
     return (result)

#main is our entry point for our program
def main():
     x=Add(5,10)
     print (x)
     y=3
     z=10
     addednumbers=Add(y,z)
     print (addednumbers)

#This is where we tell the interpreter to start the program
#if we left this line out nothing would happen when we execute the run
#option on the menu. We would have to type main() at the python prompt
#to kick the program off
main()