Head First python chapter summary

Ordered data processing

1. The numbers, strings and objects:

The main object is to understand the meaning of

Any object in python can be dynamically assigned to any variable. This presents a problem: python in what is an object?

The answer is: everything is an object.

python All data values ​​are objects, although the face of it, "Do not panic!" is a string, 42 is a number, but python programmers

"Do not panic!" Is a string object, 42 is a digital object. And other programming languages, an object can have a state, have attributes.

2. To understand the four built-in data structures

python provides four data structures may be used to store any set of objects are lists, tuples, dictionaries and collections.

General direction summarized as follows:

Now each of the four data structures to analyze (personal language and comprehension)

1. list: Actually, and among the array c language more like sequence from zero, but the list does not need to declare the size of the list.

List has the following characteristics :( personal summary)

(1) variability: variable size, the contents of a variable, not fixity

(2) Heterogeneity: the list of elements of the data structure may be different, numbers, strings, lists, and even dictionaries

(3) ordering: the list of elements that have sequence index of the first element is 0, and so, when the elements need to call a list of the time, you can use the index to find the need to call element itself

2. tuple

 Tuples and lists many common features, such as heterogeneity and orderliness, but tuples and the biggest difference is the list: an ordered set of immutable objects

Tuple is a list of immutable. This means that, once assigned a value to a tuple, the tuple will not change under any circumstances.

Guess you like

Origin www.cnblogs.com/dachang/p/11090890.html