User Tools

Site Tools


A template for writing Python code
Template for how a python module shold look like.
Author:  Asa Ben-Hur
All the stuff in triple quotes is called a docstring, and its
objective is to document the module/function in which it occurs
For details:
def double(x) :
    doubles the value that is provided as input.
    works for any Python type that support the * operator
    return 2 * x
if __name__ == '__main__' :
    This segment of the program is used for testing the code you have
    created.  It is automatically executed when you run the file as a script.
    And a more in-depth explanation with examples at:
    print ("10 * 2 = ", double(10))
    print ("Python * 2 = ", double("Python"))
wiki/template.txt ยท Last modified: 2016/09/01 09:29 (external edit)