INTERACTIVE ONLINE COURSE

Python 3

FOR BEGINNERS


"The first Python course that simply amazed me. Very well explained and easy to understand." (Alexandru Cosmin)

"The best Python course in Romania." (Iulian Geană)


ALL REVIEWS
LESSON 3
PAGE 3 / 4
Variables
Home >>> Online Lessons, Python 3

More Assignment Methods

Test the following program which contains a series of assignments as well as some interesting writing tricks:
Editor - lesson_3.py
       
Console / Output done
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.
 home   list  CONTENTS   perm_identity   arrow_upward