Math
Quiz: Chain Rule and Product Rules
Please Explain
Quiz: Integration and Linear Approximation
Please explain the pink area in the below area can be calculated as follows:
Programming
IF AND ELSE
Make Decision!
Else is "what to do" if all if statements return False
Different Priority
Not all decisions have the same priority!
Example: Buying Dinner
You will not check your walet before you are hungry!!! If hungry => If have money => Buy Dinner!
BTW, the graph I used are called "Flow Chart", which is common in programming Basically, diamonds mean decisions, rectangles means actions!
Python Syntax
var1 is 10
What if var1 = 11?
Relational operator
a<b: Is a less than b?
a>b: Is a larger than b?
a == b: Is a equal to b?
a>=b: Is a larger or equal to b?
a<=b: Is a less or equal to b?
False
False
True
False
Comapre Strings
False
True
While Loop
We have learned for loop when we need to do repeated task.
What if we don't know how many loops we need?
Wait? Then when should we end?
Use if/else statement
Example: Print all integers square is less than 100
0
1
2
3
4
5
6
7
8
9
Exercise 15 is quite difficult
Goal: Comapring 2 list with same length! example:
Error in lines 1-1
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute
flags=compile_flags) in namespace, locals
File "", line 1, in <module>
ImportError: cannot import name compareList