0 Basic python-3.2 variable assignment

Source: Internet
Author: User

In this section, we'll expand the variable assignment in detail.

1. Below we give examples of various assignments

Anint=12anfloat=2.2anstr= ' string ' alist=[' a ', ' a ', ' a ']anarray= (all-in-all) Amap={1: ' A ', 2: ' B ', 3: ' C ',}

2. Chained assignment



3. Increment assignment, i.e. self-increment or self-reduction, etc.

These operators: +=,-=,*=,/=,%=,**=,>>=,<<=,&=,|=

X+=1x=x+1x*=1

4. Multi-value Assignment

Using tuples to assign multiple values

A,b,c,d= (1,2,3,4)


5. Variable Exchange






Right here, thank you.

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

Click to jump 0 basic python-Catalogue




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

0 Basic python-3.2 variable assignment

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.