Python note (2)-should we scream for the day in our mouth?

Source: Internet
Author: User
Tags scream

Recommended:

Reading, making people progress; walking, changing life.

Reading other people's technical blogs and reading some books will make people grow. The main reason is that when I read different opinions of others, I will force myself to think more, this will feel like you have made progress.

Walking, I mean walking. What I want to say is that walking can purify the soul and put aside distractions. I really recommend my friends in the garden, even if they only have one afternoon, walking through the mountains will make your Monday more efficient.

Nonsense:

After reading "Beijing Youth" for a few weeks, every time I hear "furious life", there is always an impulse to go to Tibet, relieve pressure on my body and escape from my present life.

Most of the time, we are thinking about how to make more money, buy better things, and live a better life. Most of us are not so noble. Every day we want to serve the people and win glory for our motherland. Most of our work is not the kind of product that changes the world. Well, we are ordinary people and we cannot be ordinary people.

It seems that the common people are also patriotic. You are watching the protest, the parade, the boycott, And the taxi. We are angry only when we are recruited from Japan. TMD, brother, I really want to say: why have you been there !!! However, I still admire those friends who have been in the parade. Because of you, I feel like I have a motherland and a person who belongs to me.

The Diaoyu Islands event is also beneficial, for example, giving us a conversation when we meet in the morning .....

Should we scream? As Mr. Luo said: if we are small, it makes sense to make the world better. A beautiful world requires us, a powerful country, and you and me. We may not be able to enjoy the advantages of the rise of the empire, but today we can push forward the progress of our country, and your future generations will thank you for your efforts.

 

Python notes (2)

Continue list:

Delete element:

 
A = [1, 2, 3, 4] [2: 3] = []#[1, 2, 4]DelA [2]#[1, 2]

Clear list

 
A [:] =[]DelA [:]

List is used as a stack (post-in-first-out ):

Stack = [3, 4, 5] Stack. append (6) Stack. append (7) Stack. Pop ()#7Stack. Pop ()#6Stack. Pop ()#5

Index with negative number:

 
B = [1, 2, 3, 4] B [-2]#3

"+" Combination list:

End = ['St','Nd'] + 5 *['Th'] + ['XY']#['St', 'nd', 'th', 'xy']

Find the number of elements in the list:

 
Lst .('Hello')#Hello count

List sorting:

Sort ()#Sort the elements in the linked list.Reverse ()#Elements in inverted linked list

 

FunctionPointer problems:

 
DefF2 (A, L =[]) L. append ()ReturnLPrint(F2 (1 ))#1Print(F2 (2 ))#1, 2 L in this function call, it is [1]Print(F2 (3 ))#1, 2, 3

The parameters in the function include:

* Parameter Name: any number of parameters

**: Indicates the dictionary parameter.

 

Control statement:

If:

 If X < 0: x = 0  Print   '  Negative changed to zero  '  Elif X = 0:  Print   '  Zero '  Elif X = 1 :  Print   '  Single  '  Else  :  Print   '  More  ' 

For:

A = ['Cat','Window','Defenestrate']ForXInA:PrintX, Len (X)

While:

A, B = 0, 1WhileB <1, 1000:PrintB, A, B= B, A +B#1 1 2 3 5 8 13 21 34 55 89 144 233 377 610

Pass: NULL operation statement

 
WhileTrue:Pass

 

Dictionary: Data Structure of key-value pairs

Use List to construct a dictionary:

Items = [('Name','DC'),('Age', 78)] D= Dict (items)#{'Age': 78, 'name': 'dc '}

Interesting comparison:

X = []#ListX [2] ='Foo' #ErrorX = {}#DictionaryX [2] ='Foo'#Correct

 

The content is complex. Remember what you learn. It makes full use of free time and spare time at work.

----------------------------------------------------------------------

Hard work may fail, but not hard work will certainly fail.
Mutual encouragement.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.