Sort out the value assignment operators in Python

Source: Internet
Author: User
This article mainly introduces the value assignment operator in Python, which is a basic skill in Python. if you need it, refer to the following table to list the value assignment operators supported by all Python languages. Assume that variable a holds 10 and variable B holds 20, then:

For example:

The following example shows all the value assignment operators available in the Python programming language:

#! /Usr/bin/pythona = 21b = 10c = 0c = a + bprint "Line 1-Value of c is", cc ++ = aprint "Line 2-Value of c is ", c * = aprint "Line 3-Value of c is", c/= a print "Line 4-Value of c is ", c = 2c % = aprint "Line 5-Value of c is", cc ** = aprint "Line 6-Value of c is ", cc // = aprint "Line 7-Value of c is", c

When the above program is executed, it will produce the following results:

Line 1-Value of c is 31 Line 2-Value of c is 52 Line 3-values of c is 1092 Line 4-Value of c is 52 Line 5-Value of c is 2 line 6-Value of c is 2097152 Line 7-Value of c is 99864

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.