Skip to content

Latest commit

 

History

History
47 lines (40 loc) · 1.45 KB

Chapter_2.md

File metadata and controls

47 lines (40 loc) · 1.45 KB

Constants

Fixed values such as numbers, letters, strings

Reserved words

False, def if raise None, del import return True, elif, in, try and, else, is, while as, except, lambda, with assert, finally, nonlocal, yield break, for, not class, from, or continue, global, pass

Variables

Variables is a assignment for a value You get to choose the name of a variable Can only start with _ or lower case No dashes aloud, -

Mnemonic Variable Names

Since the variable names are declared by the programmer, python doesn't read the variable name to mean something, it only reads the definition with in the variable. Names that are descriptive can be read easier by the user, but python will be happy with a completely gibberish name like: uj9234_dafs2o

Assignment Statements

A variable is an assignment statement Requires the right side of the value to be valid for the left side to be valid

Numeric Expressions

  • Addition
  • Subtraction
  • Multiplication / Division ** Power % Remainder

Order of Evaluation

When we code in python, we need to know what comes first This is called "operator precedence"

Operator Precedence Rules:

Parentheses are always respected Exponentiation (raise to a power) Multiplication, Division, Remainder Addition and Subtraction left to right