You are on page 1of 7

Interacting with Py

• There are two ways to interact with Py (the


Python Interpreter)
– REPL (read-evaluate-print-loop)
prints the result of the evaluation and is
ready for the next instruction.
– Giving it file of instruction to evaluate
Evaluates each instruction and stops

Head First Python 2016 Page 3 to 8


Python Crash Course_ 2019 Page 4 1
Real Python Course, Part 1 2017 Page 15 to 19
Arithmetic Operators

Python For Everyone Horstmann Page 37 to 39


Python Programming by John Zelle 2009 Chapter 3 2
Arithmetic Operator Precedence

Python For Everyone Horstmann 3


Page 37 to 39 Appendix B
Python and Computer
Memory

Variables are a way to keep track of values


stored in computer memory. A variable is a
named location in computer memory.

4
You may think of computer memory as a
long list of storage locations where each
location is identified with a unique number
and each location houses a value. This
unique number is called a memory address.

5
Terminology
• A value has a memory address.
A variable contains a memory address.
A variable refers to a value.
A variable points to a value.
• Example: Value 8.5 has memory
address id34.
Variable shoe_size contains memory
address id34.
The value of shoe_size is 8.5.
shoe_size refers to value 8.5.
shoe_size points to value 8.5. 6
Syntax and Semantics
• Syntax: the rules that describe valid
combinations of Python symbols
• Semantics: the meaning of a combination
of Python symbols is the meaning of an
instruction — what a particular
combination of symbols does when you
execute it.

You might also like