More Assignment Methods
Test the following program which contains a series of
assignments as well as some interesting writing tricks:
Note. When the print function receives multiple arguments within parentheses,
separated by commas, they are displayed on the same line in order and separated by a space.
We have used assignment as an operator, giving a variable a certain value. Thus, the general form is:
v = expression
where v is the variable.
The execution principle is as follows:
• the expression is evaluated;
• v is assigned the obtained value.
Multiple assignments can also be made in the form:
v = v1 = v2 = ... = vn = expression
where v, v1,
v2, ..., vn are variables.
Run the program in the editor first.
Proceed to the next page ...