[Python] 2. Expressions
Constants
- Fixed values such as numbers, letters, and strings, are called "constants" because their value does not change
- Numeric constants are as you expect -- 123, 34.1
- String constants use single quotes or double quotes -- ('), (")
Reserved Words
- You cannot use reserved words as variable names/ identifiers
Variables
- A variable is a named place in the memory where a programmer can store data and later retrieve the data using the variable "name"
- Programmers get to choose the names of the variables
- You can change the contents of a variable in a later statement
Python Variable Name Rules
Must start with a letter or underscore_
Must consist of letters, numbers, and underscores
Case Sensitive
Sentences or Lines
*Recommend using a mnemonic variable name for human
Assignment Statement
We assign a value to a variable using the assignment statement(=)
An assignment statement consists of an expression on the right-hand side and a variable to store the result