Data Types and Arithmetic
statement : the smallest unit of code that can be executed on its own
example of an assignment : sum = first + second
expression : a piece of code that has a value
is an expression smaller and more fundamental than a statement? : yes
the data type int stands for integers and represents : whole numbers that are positive, zero, or negative
can integers have leading zeros : no
floating point limitations : mantissa and exponent
mantissa : the digits (in binary); holds about 15 significant digits; leads to rounding errors
does python have 2 division operators? : yes / and //
/ this division operator always gives a(n) : float
% finds : the remainder of division
examples of the % operator1. 6 % 32. 8 % 33. 7 % 34. 9 % 3 : 1. 02. 23. 14. 0
is ^ the same as ** in python? : no
true or false: round has either one or two arguments : true
the datatype bool represents : boolean values
boolean values are named after : George Boole
the datatype str represents : strings
str represents : a sequence of characters
converting between datatypes is also called : type casting
practice converting between datatypes:1. float(2)2. str(1.2e3)3. float("0")4. int(3.14)5. int("02")6. int(" 2 ")7. int(-4.2)8. int(4.2) : 1. 2.02. 1200.03. 0.04. 35. 26. 27. -48. 4
example of end=print("The answer is" , number , end=":" : The answer is: 45
can you use both end= and sep= in the same print statement? : yes, in either order
regression testing : whenever you change the code, go back to the beginning of the test plan and repeat all the tests in the test plan