Back to Math Projects
Python Starter Code
Instructions:
Use the code below to start any python project. Change the name of the main function 'mymain()' to anything you like, just be sure to change the call-out of the function below in the if statement at the end which begins the execution of the our program. This is why large games and applications take a little bit to load, all functions and other instructions are loaded up in memory, then executed at the end of the code.
#------------------------------------------------------------------------------- # Name: Python Starter Code # Purpose: copy-paste code to start all python projects # # Author: David @ ElectricTeaching.com # # Created: 11/12/2011 #------------------------------------------------------------------------------- # Import libraries and assign all global variables below # This is the main function which may call other functions in a large programming project. def mymain(): # The if statement below is the method that python uses to start executing a program. # Every function (or set of instructions) are read and stored in memory # then the program begins to execute the functions with this if statement. if __name__=='__main__': mymain() # This calls-out the function above to begin executing.