Homework after last lesson:
1. Using the list to parse the output: [(0,0), (0,2), (2,0), (2,2)]
Method 1:
Method 2:
Method 3:
2. Use the List Builder to print the Fibonacci sequence
3. Generating a list using list resolution [1x2,3x4,5x6,7x8,..., 99x100]
4. Use the 3-layer for-loop list generation to find the symmetric 3-digit number, for example: 121, left-to-right, or the original symmetry number
5. Write a function that accepts a list and then returns all the strings in the list to uppercase, and non-string elements are ignored
If you follow the usual wording:
Parsing by list is a lot easier:
Note that there is no change to the original list at this time
Copy module:
1. What is copy
Earlier in the list of shards to mention a little bit about the copy (copy), in this chapter will detail about the copy module
1. Use
Do a backup of the data, a little understanding of operations should have heard full backup and incremental backup it? In fact, the copy is used here, so in practical use, the copy is very common
3. Function (method):
See these methods, actually compared to the front, actually not much, right? Ignoring methods with special features is actually just a few, right?
However, the most common use of this module is copy and Deepcopy method, other basic rarely used, so directly skip
Copy: This method is a simple copy, similar to the common sense of the copy, it is another name called "Shallow copy" (or shallow copy), in other words is a copy of the parent object reference
Cases:
Deepcopy: This method is a bit more powerful than a shallow copy, which is called deep copy (or deep copy), in other words, a copy of the object's resources.
Summarize:
Shallow copy is the outermost copy of the original object, if there is a direct reference to the inner layer
A deep copy is a copy of the entire parameter resource of the original object, regardless of whether it has an inner layer or not, it has nothing to do with the original object
Is it really simple? Well, if you don't understand, practise more.
Baptism of souls, cultivation of Python (16)--List of advanced topics, previous work on +copy module