Please enable JavaScript.
Coggle requires JavaScript to display documents.
Python Zero to Mastery (Introduction (Basics 1 (Basics 2 (Object Oriented…
Python Zero to Mastery
Introduction
-
-
-
-
Python 2 vs 3
In 2008, the founders of python wanted to change a bunch of things
these changes were breaking changes meaning previously written python 2 syntax code would crash if ran on python 3
-
-
Basics 1
-
-
Numbers
-
when performing mathematical operations, the types above go hand to hand
Math Functions
python has many, round and abs are two examples
-
-
Variables
conditions
-
-
-
-
can include letters, numbers, _
-
-
Expression vs Statements
expression occurs at the RHS of =, statement is the entire line
-
-
Type Conversion
can be done very easily in python, ex: str(100)
-
-
-
Immutibility
string are immutable, they cannot be changed
-
-
-
-
List Slicing
-
lists are pass by reference, just like JS
to duplicate a list:li2 = li1[:]
-
-
Common List Patterns
list(range(100))
note, range doesn't include 100
-
-
Dictionaries
-
-
-
you can extract keys, values, entries, and use the in operator like lists
-
Sets
{}
-
-
think of these like sets in statistics, syntax is the same and they have methods that are named appropriately
Basics 2
Conditional Logic
-
and, or keywords can be used in statement
-
-
-
Logical Operators
and, or, >, <, >=, <=, ==, !=, not
-
-
is vs ==
using == you are checking the values, type conversion will occur
using "is", you check to see if the address matches
For Loops
-
can use lists, tuples, sets, dictionary, strings
-
range
-
range(start, end, stepover)
-
while loops
-
-
useful for more complex problems, for example asking for input over and over
-
-
Scope
-
start at local, then go to parent, ..., global, built-in python
global
try to avoid using this keyword, instead use dependency injection
-
-