Starting from this lesson, we will introduce Python-related things in 6.00. The first step is to configure the environment, that is, install Python (2. x series) and the corresponding idle. In ubuntu, Python comes with python. For example, it is easier to install Python 12.10. idle in Ubuntu 2.7. Use sudo apt-Get install idle to install it.
How to start learning an object-oriented language? Here is a question: What Is Object-Oriented?Program? The answer to 6.00 is as follows:
Type> Expression> Control> input/output
Type is a decisive element that gives meaning to the cold ice 10, for example, 0110 1100 0110 1111 0111 0110 0111 0101 interpreted as characters according to ASCII rules, it can produce the beautiful word "love. What is a type? I think the type is the value range of the index data and the operations that can be performed on the data. For example, a 32-bit integer defines 32 bits to represent itself, and also specifies the corresponding operation in syntax.
In object-oriented programming, a class is the most basic concept. A real object-oriented programming language should classify all data into a class.
With the class, the next step is to make these classes work together, so the next concept comes out naturally: expressions.
An expression is a combination of operators and operation numbers.
Input and Output: the input and output are generally not in the core of the language and are usually in the form of libraries, for example, the famous printf in C. Why do I learn the input and output databases when learning new languages? Naturally, we hope to get a "live" program immediately, even if we print a "hello World", it will make new users feel angry, I still remember my excitement when I used C to play Hello world in DOS, as if I had magic :)
The following are Python-related parts:
Type (x): Data Type of output X, such as int, STR, nonetype
Print X or print (x): output the value of X.
Raw_input ('msg '): Get user input
INT (x): Convert X to int type data
Control Structure:
If expr:
Statement
Elif expr:
Statement
Else expr:
Statement
Whle expr:
Statement