Python daily delicious (1)-variable exchange

Source: Internet
Author: User
Python is the first delicious, so you can exchange variables conveniently and quickly! Why python ?! Because temporary variables are not required for switching variables in python! For example:
A, B, c = B, C,


Let's look at a complicated example. Let's look at the well-known "Bubble Sorting:
Array = [ 1 , 2 , 5 , 3 , 6 , 8 , 4 ]
For I In Range (LEN (array) -   1 , 1 , - 1 ):
For J In Range (0, I ):
If Array [J] > Array [J +   1 ]:
Array [J], array [J +   1 ] = Array [J +   1 ], Array [J]
Print Array

Well, we'll eat it here today. Please pay close attention to it. There will be more delicious meals waiting for you in the future!

 

Python daily delicious series (total)

Python daily delicious (1)-variable exchange

Python daily delicious (2)-the art of character Traversal

Python daily delicious (3)-character conversion

Python daily delicious (4)-isinstance determines the object type

Python daily delicious (5)-ljust just Center

...

 

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.