Page 25 - Programming With Python 3
P. 25
An Introduction to STEM Programming with Python — 2019-09-03a Page 12
Chapter 1 — Python — Arithmetic, Numbers, and Variables
Free
Illustration 4: Variable Assignment in Python
eBook
You may assign the result of an expression easily to a variable by placing the expression after the equal
sign.
1| Area = 8.5 * 9.3
Edition
variable = expression Statement
The = sign performs assignment. It evaluates the expression on the right of the
equal sign and stores the result into the variable.
https://docs.python.org/3/reference/simple_stmts.html?highlight=assignment#assignment-
Please support this work at
statements
http://bit.ly/py3assign
http://syw2l.org
NOTE: Variable names are case-sensitive. Also, variables must start with a letter and contain
only letters, numbers, and underscores. You should avoid creating a variable with the name of a
builtin function in Python, unless you know what you are doing.
Free
Variable Retrieval
Once a value has been assigned a value, the variable name may be used in most places where a constant
value may be used. You may retrieve the value several times, but the value stored will not change until
eBook
you explicitly change it.
Edition
Illustration 5: Retrieval from a Variable
1| a = 9
2| b = 6
Copyright 2019 — James M. Reneau Ph.D. — http://www.syw2l.org — This work is licensed
under a Creative Commons Attribution-ShareAlike 4.0 International License.

