Differences between revisions 6 and 7
Revision 6 as of 2012-10-10 17:52:47
Size: 891
Editor: hassan
Comment:
Revision 7 as of 2012-10-11 07:11:12
Size: 1438
Editor: hassan
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The metabolic modelling we will be using, {{{ScrumPy}}}, is written in {{{Python}}}.
{{{Python}}} is a high-level, object-oriented, interpreted programming language, it has a
lan
ge standard library, and supports multiple programming paradigms. It is also syntactically clear and easy to learn. This is a very brief introduction to some of the basic features of the language, for a
more complete introduction to the topic, see Lutz & Ascher, "Learning Python" O'Reilly Media inc. (Edition 2 or greater).
The metabolic modelling we will be using, {{{ScrumPy}}}, is written in {{{Python}}}. {{{Python}}} is a high-level, object-oriented, interpreted programming language, it has a large standard library, and supports multiple programming paradigms. It is also syntactically clear and easy to learn. This is a very brief introduction to some of the basic features of the language, for a more complete introduction to the topic, see Lutz & Ascher, "Learning Python" O'Reilly Media inc. (Edition 2 or greater).
Line 22: Line 19:
== Lists == === Numbers ===

The numerical types we will be dealing with are integers, {{{int}}}, and floating-point numbers {{{float}}}. Integers are written as a sequence of digits. Floats are written as digits with a decimal point in the sequence, and an optional exponent ({{{e}}} or {{{E}}}).

{{{#!python
>>> n_int = 135
>>> n_int
135
>>> n_float = 10e-10
>>> n_float
10e-10
}}}


The type of a given data object can be checked using the built-in function {{{type()}}}. Examples:

{{{!# python
n1



}}}

== Lists and tuples ==
Line 25: Line 45:

== Modules ==

Introduction to Python

The metabolic modelling we will be using, ScrumPy, is written in Python. Python is a high-level, object-oriented, interpreted programming language, it has a large standard library, and supports multiple programming paradigms. It is also syntactically clear and easy to learn. This is a very brief introduction to some of the basic features of the language, for a more complete introduction to the topic, see Lutz & Ascher, "Learning Python" O'Reilly Media inc. (Edition 2 or greater).

Getting started

We will be using Python from the ScrumPy environment. To start a new ScrumPy session open a terminal and type "ScrumPy":

user@machine:~$ ScrumPy &

which will launch the ScrumPy window.

Data types

Numbers

The numerical types we will be dealing with are integers, int, and floating-point numbers float. Integers are written as a sequence of digits. Floats are written as digits with a decimal point in the sequence, and an optional exponent (e or E).

   1 >>> n_int = 135
   2 >>> n_int
   3 135
   4 >>> n_float = 10e-10
   5 >>> n_float
   6 10e-10

The type of a given data object can be checked using the built-in function type(). Examples:

{{{!# python n1

}}}

Lists and tuples

Dictionaries

Modules

Objects

Loops

None: Meetings/Delhi2012/Practicals/Practical_2/PyIntro (last edited 2012-10-12 13:53:26 by hassan)