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