Expression is a combination of values, variables, and
operators. A value all by itself is considered an expression, and so is a
variable, so the following are all legal expressions.
>>>x = 5 >>>x + 17 22
If you type an expression in interactive mode, the
interpreter evaluates it and displays the result:
>>> 2+5 7
Important:
expressions in a script all by itself doesn’t do anything.
This can be common source of confusion for beginners.
What is result of the following expression.
>>> x = 5 >>> x + 1 6
Nema komentara:
Objavi komentar