CSC108H1 Lecture Notes - Lecture 1: Negative Number, Memory Address, Id1
yifanyang and 39659 others unlocked
21
CSC108H1 Full Course Notes
Verified Note
21 documents
Document Summary
#when writing programs, we want to put in english language explanations called comments. Whatever comes after the # symbol is not evaluated. Two types of numbers: int and float. Division (/) produces a float since answer might not be an integer. // is integer division; produces an int. Order for precedence from highest to lowest. Symantic error: statement does not make sense since result is not defined. Min, max, abs (absolute value), pow, round. If you need help, help(whatever you need help with) e. g. help (pow) For power functions with 3 arguments, it becomes (x**y)%z. E. g. pow(2,3,5) becomes 23 % 5 = 8%5 = 3 (remainder 3 for 8/5) Min of 1 argument, max of 1 argument. If second argument is a negative number, round to the left: e. g. round(1234. 5678,-2) = 1200. 0. For rounding integers, round to nearest even integer. E. g. round(3. 5) = 4; round(4. 5) = 4.