I finished the pre-work on Saturday night. So that was module 5 (Math) and 6 (Conclusion and Reviews).
So the Math was: number systems, order of operations, linear equations, exponents, logarithm, averages, and geometry.
Binary hexadecimal and decimal
- Binary == base 2
- Decimal == base 10
- Hexadecimal == base 16
And when you are using the hexadecimal system, the value of the letters are as follows:
- A == 10
- B == 11
- C == 12
- D == 13
- E == 14
- F == 15
How to convert from binary to decimal
How to convert from hexadecimal to decimal: https://www.binaryhexconverter.com/hex-to-decimal-converter
Order of Operations
We have to consider the order of operations used in math as well as the order of precedence used in Python, which is basically the same as PEMDAS used in arithmetic/math.
- Parentheses ()
- Exponentiation **
- Multiplication * and Division / [if there is more than one of these in the expression, they are evaluated left to right]
- Addition + and Subtraction – [if there is more than one of these in the expression, they are evaluated left to right]
The basics of linear equations, which are all about using what you do know to find out what you don’t know.
How we get a variable like x to stand on its own, with a solvable expression on the other side of the equals sign. We accomplish this by using what amounts to a variation of the Golden Rule, “do to others what you would have them do to you.” In this case, it is “do to the side without the variable that which you do to the side with the variable.”
A repl calculating interest compounded monthly, which to my surprise, involved exponents!
Now that I am looking at it again, I remember helping my son figure out compound interest in school, but clearly it didn’t stick for me, because it looked brand new to me two days ago.
Logarithms are used in computer programming to simplify mathematical calculations. They are used in computer modeling, computer imaging, cryptology, and evaluating the complexity of algorithms. The key point to remember is that logarithms are the reverse of the operation of exponentiation.
There are three types of averages: mean, median, and mode. a mean average can be found by adding up all the numbers in a list and then dividing that result by the number of items in the list.
sidenote on len function
The len function gives us the number of items in a string.
Perimeter and area of a rectangle
A repl calculating perimeter and area of a rectangle
- Area of rectangle = length * width
- Perimeter of rectangle = 2 * (length + width)
- Area of square = side * side (or, side ** 2 remember that ** is the Python exponent operator)
- Perimeter of square = 4 * side
Radius, diameter, and circumference of a circle
Repl calculating radius, diameter and circumference of a circle
- Radius = Diameter / 2 (Note: this is another way of saying the radius is half the diameter.)
- Radius = Circumference / (pi * 2)
- Diameter = Radius * 2
- Diameter = Circumference / pi
- Circumference/Diameter = pi
- Circumference = Diameter * pi
- Circumference = Radius * pi * 2
Area of a circle
A Repl calculating area of a circle
- Area = pi * (radius **2)
- Area = pi * ((diameter / 2) ** 2)
- Pi = area/(radius **2)
Conclusion and Review
What we’ve learned so far . . .
- what programming, coding, and debugging are
- how best to learn new skills and information
- how your computer works
- how to code basic programs in Python
- and a number of math fundamentals that are useful for coding.
Super Common Bugs To Be Aware Of
Here is a list of common errors that Python programmers encounter:
- Using the assignment operator = when you mean to use the equality operator ==.
- Failing to match parentheses (i.e., you are missing an opening or a closing one somewhere in your code).
- Incorrect indentation. This could be a code block (like a loop body, for one) not being indented properly, or if you mix tabs and spaces in your indents you can trigger an error.
- Typos in your variable or function names.
- Quote issues: mixing single and double quotes, forgetting a quote, using a quote around a boolean value, doing something like this text
- Using a variable, or object, before you have initialized it.
- Naming local variables and global variables the same and then trying to use both in the same scope.
I’m a freelance web consultant living in Fort Lauderdale, Florida. I work with clients to create beautiful, functional websites. I am also a Certified Scrum Master and I love working with and improving teams.