** | Exponent (Power) | 1st |
* / // % | Mult, Div, Floor, Mod | 2nd |
+ - | Add, Sub | 3rd |
== Equal | != Not Eq |
and Both True | or Any True |
not Flip T/F | in Exists? |
| .strip() | Kill whitespace |
| .lower() | " code " |
| .upper() | " CODE " |
| .replace("o","a") | " Cade " |
| .find("d") | Index (3) |
| .pop(i) | Remove at index |
| .remove(v) | Remove value |
| .insert(i,v) | Add at index |
| .sort() | Order A-Z |
| v in L | Check exists |
"w"=Overwrite, "a"=Append
Goal: Add up numbers or count items.
Goal: Find largest item without max().
Goal: Force user to give valid integer.
Goal: Copy only even numbers to new list.
When in doubt, use Parentheses.
| Order | Operator | Desc |
| 1. KING | ( ) | Parentheses |
| 2. Power | ** | Exponents |
| 3. Sign | -x, +x | Positive/Neg |
| 4. Math | * / // % | Mult/Div |
| 5. Math | + - | Add/Sub |
| 6. Compare | == > < | Relational |
| 7. Logic | not | Logical Not |
| 8. Logic | and | Logical And |
| 9. Logic | or | Logical Or |
Input: User data (params)
Process: The logic/math
Output: The result (return/print)
| abs(-5) | 5 (Positive) |
| round(3.6) | 4 (Nearest) |
| round(3.14, 1) | 3.1 (1 decimal) |
| max(1, 2) | 2 (Largest) |
| min(1, 2) | 1 (Smallest) |
| len(obj) | Length |
| type(x) | Check Type |