sweigart chapter 1 Flashcards
interactive shell/Read-Evaluate-Print Loop (REPL)
lets you run (or execute) Python instructions one at a time and instantly shows you the results.
expressions
consist of values (eg. 2) and operators (eg. +) and can always evaluate (reduce) down to a single value. a single value is also considered an expression but it evaluates only to itself. you can use expressions anywhere in Python code where you could also use a value.
precedence
the order of operations. python math operators are similar to mathematics. parentheses can be used.
data type
a category for values, where every value belongs to one data type.
strings
text values surrounded by single quote (‘) characters, also known as strs.
integer
eg. 1
floating-point number (floats)
incorporates a decimal point, eg. 1.0
empty/blank structure
a string with no characters in it (“).
string concatenation operator
when + is used on 2 string values it joins the strings.
string replication operator
when * is used on one string value and one integer value. it evaluates the expression down to a single string value that repeats the original string a number of times equal to the integer value.
variable
a box in the computer’s memory where you can store a single value. if you want to use the result of an evaluated expression later in your program.
assignment statement
used to store values in variables. it consists of a variable name, an equal sign (assignment operator), and the value to be stored.
initialised
when the variable is created the first time a value is stored in it. after that, you can use it in expressions with other variables and values.
overwriting a variable
when a variable is assigned a new value and the old value is forgotten.
camelcase
using capitalised letter for every new word instead of underscores. eg. current_balance becomes currentBalance.