Skip to content

Latest commit

 

History

History
9 lines (8 loc) · 1.74 KB

python_summary.md

File metadata and controls

9 lines (8 loc) · 1.74 KB

Summary of Fundamental Python

1. Data Types 2. Flow Controls 3. Inputs Outputs 4. Functions 5. Modules
Scalar: int, float, bool (True, False), None. =, +=, -=, +, -, *, /, %, **. Relational: ==, != <, ,<=, >, >=, is, is not, in, is in, not in. Logical: and, or, not Console I/O: print("hello", end=""), input("your name?") Built-in: type(), len(), int(), str(), range(), min(), max(), round() Standard: math, os, sys, random, datetime
Collection: str, range, tuple, list, dict, set. Index & slicing: x[index], x[start:stop] Loops: for i in range(5), while x < 5, while True File I/O: with open(path, mode) as: "t" - text, "b" - binary, "r" - read, "w" - write, "x" - create, "a" - append Named: def func(args), return, pass Third-party: numpy, statistics, scipy, pandas
Conversion: int(), str(), list(), set() Conditions: if, elif, else File Input: read(), readline(), readlines(). File Output: write() Anonymous: lambda args : expression Import: import, from x import y
String operations: strip, split, replace, join, format/f-string, index, find, upper, lower Controls: break, continue, return, pass Output formatting: format()/f-string Arbitrary args: *args, **kwargs Packages: pypi.org, pip, conda, venv
List comprehension: [x for x in C if condition] Exceptions: try, except, throw Web scraping: requests, BeautifulSoup, selenium, pandas.read_html() FP: func is object, func as argument, zero side-effect, map(), filter() OOP: class/type, instance, abstract base class (ABC)