SIJ1004
Brief History of Python
Introduction to Computational Biology Invented in the Netherlands, early 90s
by Guido van Rossum
Class 7. Introduction to Python
Named after Monty Python
Open sourced from the beginning
Considered a scripting language, but is
much more
Scalable, object oriented and functional
from the beginning
Used by Google from the beginning
Increasingly popular
1
Python’s Benevolent Dictator For Life Installing
Python is pre-installed on most Unix systems,
including Linux and MAC OS X
“Python is an experiment in The pre-installed version may not be the most
how much freedom program- recent one (2.6.2 and 3.1.1 as of Sept 09)
mers need. Too much freedom Download from http://python.org/download/
and nobody can read another's Python comes with a large library of standard
code; too little and expressive- modules
ness is endangered.” There are several options for an IDE
- Guido van Rossum • IDLE – works well with Windows
• Emacs with python-mode or your favorite text editor
• Eclipse with Pydev (http://pydev.sourceforge.net/)
2
3
Editing Python in Emacs
Emacs python-mode has good support for editing
Python, enabled enabled by default for .py files
Features: completion, symbol help, eldoc, and inferior
interpreter shell, etc.
4
Data type Variables
Strings Storing data
Numeric variable = (data)
Boolean value Variable storing string data:
Variable storing numeric data:
Variable storing Boolean value:
5
Getting input from users Groups of data
Allows users to input data into the program. List
name = input() • name = [data1, data2, data3]
Tuple
• name = (data1, data2, data3)
6
Functions If statement
Allow the program to respond to input from user.
A set codes to do a specific task.
A condition:
Writing a function that says “Hello” on your screen.
• True or false
Using “def” keyword
The function: • Value
Calling the function:
Return (getting back) information from a function.