Introduction to Python


Contents

How to install Python on Linux
How to run a Python program
The basic of Python codes
Data expressions
Built-in functions in Python
Interactive input/output
Conditional statement for Python
Loop structure for Python
Creating your own functions
Python modules
Reading/writing files for Python
Error handling code
Object Oriented Programming (OOP)
Tkinter package for GNU programming


Python modules

There are several available mudules for Python. Necessary modules are called by "import" in the program code. For the other modules and detailed explanations, refer to http://docs.python.org/py-modindex.html As stated, you can use a module by calling it by "import." The commands are performed in the code by attaching the module name. For example,
import math
sn=math.sin(3.14)
print sn
$ 0.00159265291649
To omit the module name, you can arrange as follows:
from math import *
sn=sin(3.14)
print sn



Back to Electronics Page

Back to Hiro's Physics Main