CSC108H1 Lecture Notes - Lecture 1: Memory Address, Triangle, Exponentiation
yifanyang and 39659 others unlocked
21
CSC108H1 Full Course Notes
Verified Note
21 documents
Document Summary
Variable: a named location in computer memory (python keeps variables in a separate area of memory from values) Terminology: a value has a memory address, a variable contains a memory address, a variable refers/points to a value. Examples of use: value 8. 5 has memory address x34, variable shoe_size contains memory address x34, the value of shoe_size is 8. 5, shoe_size points/refers to value 8. 5. Variables example using the area of a triangle. Rules for executing an assignment statement: evaluate the expression on the right of the = sign to produce a value. This value has a memory address: store the memory address of the value in the variable on the left of the =. Rules for legal python names: names must start with a letter or , only contains letters, digits, and _ Rules for executing a function call: evaluate the arguments, call the function, passing in the argument values. Built-in functions max function: which of several numbers is the largest.