1. There are two main loops, counting cycles and condition loops. The former is generally called A For loop, which is generally called a while loop. To stop a runaway Python program, just press CTRL C.
2. There are two types of jumping out loops, break and continue. The former completely terminates the cycle, and the latter jumps to the next iteration of the loop ahead of time.
3. Information with current enquiry:
----Python function library: http://www.lfd.uci.edu/~gohlke/pythonlibs/
----Learning Programming with kids website: http://www.manning.com/sande/
----Pygame module: http://pygame.org/download.shtml
----msvcr71.dll file: http://baike.baidu.com/link?url=UuOOD7OPPvmArYV66RCGAPPP3_ besvjrl2cc416ozg-ykpkgtuub3zmzsszdtoj6l-dbkcanczog9wtfeayh0a
4. In many cases, and not just confined to the loop, the value of the print variable will be helpful to you.
5. Record a question, the 10th chapter writes the same as the source code, only I use the Pygame module different, why my program runs out, the skier's movement speed and the small tree banner appears the quantity is much smaller? (Note: This code 200 line, the book copied, but a lot of did not understand, look forward to continue learning to understand all the code meaning)
6. What is the role of nested loops? The best job of nesting loops is to derive all possible permutations (permutation) and combinations (combination) of a series of decisions. (Note: The Order of arrangement, the combination of the order)
7. There are two methods currently known to express multiple lines. Method one, with a backslash (/), means "this line is not over, and the next line is part of the line." Method Two, you can also add an extra pair of parentheses around the entire expression.
8. Correct a mistake in the book, the title asks for an asterisk, but the answer is to shoot the asterisk (because the print will wrap every line), it should take my notation (but not the nested loop implementation). The code map is as follows:
9.print letters[1] and print letters[1:2] output is different, more fundamentally, the output type is different, the former output is a string or integer or floating-point type, the latter output array type.
10. Three ways to add elements. The first append (), adds an element to the end of the list, a second extend (), adds multiple elements to the end of the list, and a third insert () adds an element to a position in the list.
11. Three ways to delete an element. The first remove () removes the element you select from the list, you do not need to know where the element is in the list, the Second del () allows the element to be removed from the list using the index , and the third pop () to remove the last element from the list. Pop (n) can also provide an index and remove elements from the list at the index location.
12.sort () automatically sorts the strings from small to large in alphabetical order, and if they are numbers, they are sorted from small to large in numerical order. Sort () modifies the list in place, changing the original list instead of creating a new ordered list.
13. What are the benefits of sharding notation? The first thing to understand is that when you assign another name to something, you just add a new tag to the same thing, but if you do want to create a copy of the list, you can't simply add a new tag, and you can use the Shard notation, for example: New = original [:], which means "copy all the contents of the list, From the first element to the last element.
14. Numbers and strings are immutable (immutable), we can change just to assign a name to which number or string, that is, only move the label, and the list in addition to the tuple (the list using parentheses, rather than the brackets), is a change (mutable), you can append or delete elements inside.
15. How do I define a data structure? A method of collecting, storing, or representing data in a program. Data structures include variables, lists, and others, which represent the way in which a program is organized.
0502 "Learning Programming with Children" reading notes 3