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
Error handling code
You can deal with errors by using 'try' and 'except' like Java or other languages. There is a simple program:
try:
n = input('Type some number.')
for i in [10.,20.,30.]:
print i/n
except:
print 'An error has occurred.'
When you input zero, the program executes the command in 'except' section.
Back to Electronics Page
Back to Hiro's Physics Main