Basis
Input: input
the input function returns a String
Output: print
Comments: # (single-line comments)
Data Types
Show data type (type)
Conversion: int (convert to integer), float (convert to float), str (convert to string), list (convert to list)
Numbers
Types: integer (int), float (float), complex
Operations
+, -, *, /
** (power),
// (floor division)
% (modulus).
Assignment: =, +=, -=, *=, /=,**=...
Structures
Conditionals
Logical comparators: == (equal), != (not equal to), >, <, >=, <=
Logical operators: and, or, not
True and False Values
All following values are consider false.
None
False
zero of any numeric type, for example, 0, 0L, 0.0, 0j.
any empty sequence, for example, '', (), [].
any empty mapping, for example, {}.
instances of user-defined classes, if the class defines a __nonzero__() or __len__() method, when that method returns the integer zero or bool value False.
All other values are considered true.
Loops
break (exit the nearest loop)
continue (go to the next iteration)
Functions
Common Pre-defined Functions
Functions that return multiple values will be packaged in the form of a tuple
Files
Classes
Modules
Import: import, from ... import
Python Standard Library:
External libraries
bs4 (Beautiful Soup, parsing HTML)
numpy (arrays and mathematical computations)
Course Specific:
installing library %pip install <library_name>
Data Structures
Algorithms
Searching
Sorting
Jupiter Notebook
%%time #Show cell runtime