4 February 20021

It's time to play with the Python!!

picuture of python digesting din-din

Starting and Running Python First we learn how to start Python and quit it cleanly.

To start Python, type python in a cmd window or python3 in a Mac Terminal window. You will see this, where unix> is your system prompt.

unix> python
Python 3.8.5 (default, Sep  4 2020, 02:22:02) 
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

To quit, type quit(). You can also use control-D on a Mac or control-Z in windoze.

Numbers

We begin our study of the Python type ecosystem with its numerical types. There are three numerical types in Python.

We use the term object to refer to any datum stored in memory.

Built-in Functions You will meet lots of these. Let's learn about a couple of them.

Infix Binary Arithmetic Operators Hello, Miss Wormwood!

PEMDAS

The arithmetic operators have the Wormwoodean order of operations you learned in Algebra I.

Note The exponentation opearator, unlike its brethern, associates from right to left.

2**4**2 &arrr; 65536

2**4**2 = 2**16 = 65536

Relational Operators These are all familar.

Variables These are typeless names we stick to objects. Think this way: a variable "points" at its object.