Git Product home page Git Product logo

python's Introduction

Python

Complete Python Developer in 2020: Zero to Mastery Created by Andrei Neagoie

Section 1: Introduction

  • Course Outline
  • Join Our Online Classroom!
  • Discord Community

Section 2: Python Introduction

What Is A Programming Language

  • Source code (human readable)
    • => interpreter: goes line by line and executes it consecutively
    • => or compiler: takes code all at once, reads the entire file and then translates that to machine code.
  • cypthon VM (virtual machine)

How to Run Python Code

  • Terminal
  • Code Editors: sublime text, visual studio code
  • IDEs: PyCharm, Spyder
  • Notebooks: jupyter
  • python3
  • exit()
  • python main.py

Python 2 vs Python 3

  • Languages have tradeoffs, so choose depending on purpose
  • Python is great for developer code

Section 3: Python Basics

Learning Python

  • Terms
  • Data Types
  • Actions
  • Best Practices

Python Data Types

Developer Fundamentals I

  • Learn a language by using it not by memorizing it.

Operator Precedence

Optional: bin() and complex

Variables

  • Python Keywords
  • Best Practices
    • snake_case
    • start with lowercase or underscore
    • letters, numbers, underscores
    • case sensitive
    • don't overwrite keywords
    • CONSTANTS are CAPITALIZED

Expressions vs Statements

  • expressions: pieces of code that produce a value (right side of equation)
  • statements: entire lines of code that perform an action

Augmented Assignment Operator

  • e.g., +=, *=

Strings

String Concatenation

Type Conversion

Escape Sequences

  • \ to make next char a string
  • \t for a tab
  • \n for a new line

Formatted Strings

  • f string (f ...) - recommended
  • .format() still used from Python 2

String Indexes

  • access different parts of a string by its index

Immutability

  • once created, you cannot reassign part of a string

Built-In Functions + Methods

Booleans

Developer Fundamentals II: Commenting Code

Lists

  • ordered sequence of objects
  • like arrays in other languages
  • List Slicing
  • Lists are mutable
    • copying vs modifying

Matrix

  • an array with another array inside it [multi-dimensional]

Dictionaries

  • Also known as mappings or hash tables. They are key value pairs that DO NOT retain order dict data type

Developer Fundamentals III: Using Data Structures

Dictionary Keys

  • has to be immutable (a list cannot be a key because it can change)
  • has to be unique, a repeated key will be overwritten

Dictionary Methods

Tuples

  • immutable lists: e.g., children = ('Omi', 'SungOh')
  • Tuple Methods
    • count()
    • index()

Sets

Section 4: Python Basics II

Conditional Logic

  • if
  • elif
  • else

Indentation in Python

Truthy vs Falsy

Ternary Operator

condition_if_true if condition else condition_if_false

Short Circuiting

Logical Operators

  • and, or, >, <, ==, !=, not, and not, etc.

is (===) vs ==

For Loops

Iterables

  • list
  • dictionary
  • tuple
  • set
  • string

range(), enumerate()

While Loops

break, continue, pass

Our First GUI: A Christmas Tree

Developer Fundamentals IV: What is good code

  • clean
  • readable
  • predictable
  • DRY - don't repeat yourself

Functions

  • def define a function
  • should do one thing really well
  • should return something

Parameters and Arguments

  • parameters define variables to pass into a function
  • arguments are called (invoked) when running a function

Default Parameters and Keyword Arguments

  • assign a default parameter
  • can use keyword arguments to explicitly define the values rather than positional arguments

Return

  • functions should return something

Methods vs Functions

  • .method has to be owned by something to the left of the period

Docstrings: comment code inside of functions

def test(a)
'''
Info: this function tests and prints param a
'''
  print()

test('!!!')

Clean Code

*args and **kwargs

  • Rule order: params, *args, default parameters, **kwargs

Scope - what variables do I have access to

  1. start with local
  2. Parent of local?
  3. Global
  4. Built in Python functions'

global keyword and nonlocal keyword

  • nonlocal used to refer to the parent local
  • generally write clean code and don't use these keywords

Why Do We Need Scope

  • garbage collection

Python Exam: Testing Your Understanding

Section 5: Developer Environment

  • Code Editors: lightweight as they provide editors and linting
  • IDEs are full-fledged environments
  • Tools
    • Code Editors
      • Sublime Text
      • Visual Studio Code
    • IDEs
      • PyCharm
      • Spyder
    • Notebooks
      • jupyter

Code Formatting - PEP (Python Enhancement Proposals) 8 (Style Guide for Python Code)

Section 6: Advanced Python: Object Oriented Programming

Object Oriented Programming

  • a paradigm for structuring and writing our code
  • modeling our code in terms of real world objects
  • CLASS => instantiate instances
    • class CamelCase:

Attributes and Methods

init

@classmethod and @staticmethod

Developer Fundamentals V: Test Your Assumptions

Encapsulation

  • the binding of data and functions that manipulate that data into one big object to keep everything in this box for interaction

Abstraction

  • hiding information and giving access to only what's necessary

Private vs Public Variables

  • no true private variables in Python
  • but convention to use underscore _variable to indicate it shouldn't be touched

Inheritance

  • allows new objects to take on the characteristics of existing objects

Polymorphism - many forms

  • object classes can share the same method name but those method names can act differently based on what object calls them

super()

Object Introspection

  • introspection: the ability to determine the type of an object at runtime.

Dunder Methods

  • special methods that Python recognizes to modify our classes
  • Dunder Methods

Multiple Inheritance

  • not recommended way to code

Section 7: Advanced Python: Functional Programming

  • focus on separation of concerns
  • separate data and functions
  • Goals the same regardless:
    • Clear and Understandable
    • Easy to Extend
    • Easy to Maintain
    • Memory Efficient
    • DRY

Pure Functions

  • separation between the data of a program and its behavior
  • Rules:
    • Given the same input it will always return the same output
    • It should not produce any side effects
  • map(), filter(), zip(), reduce()

Lambda Expressions

  • one-time anonymous functions
  • reduces length of code but makes it less readable

Comprehensions (List, Set, Dictionary)

Section 8: Advanced Python: Decorators

  • @classmethod
  • @staticmethod

Higher Order Functions

  • a function that accepts another function in its parameters or returns another function

Decorators

  • supercharges our functions
  • a function that wraps another function and enhances it or changes it

Section 9: Advanced Python: Error Handling

Section 10: Advanced Python: Generators

  • e.g., range() uses yield keyword to pause and resume functions
  • generators are a subset of iterables

Python Exams and Exercises

Section 11: Modules in Python

  • Modules: file_name.py
  • Packages: folders that require an init.py file
  • __name__
  • if __name__ == '__main__':
  • Built-in Modules: Python Module Index
  • import only what you need: e.g., from random import shuffle
  • Python Package Index
  • e.g., search for 'read csv python3 built-in'
  • pip install PIP
  • virtual environments venv
  • Useful Modules

Developer Fundamentals VI: Pros and Cons of Libraries

Debugging in Python

  • linting
  • IDE or Text Editor
  • Read errors
  • Python Debugger or pdb (can also test inside pdb)
import pdb

def add(num1, num2):
    pdb.set_trace()
    return num1 + num2

print(add(4, 5))

Section 13: File I/O (input/output)

  • open
  • Python uses a cursor to read a file
  • Read, Write, and Append (mode='r')
  • File Paths pathlib
  • File I/O Errors

Section 14: Regular Expressions

Section 15: Testing in Python

  • Tools

    • pylint
    • pyflakes
    • AutoPEP 8
  • Unit Tests

    • run all tests (-v for verbose): python -m unittest -v

Section 16: Career of a Python Developer

Python Careers

  • Software Engineer
  • Python developer
  • Data Scientist
  • Data Analyst
  • Research Analyst
  • Backend Developer
  • Testing/Automation
  • Machine Learning

Section 17: Scripting with Python

Image Processing

Developer Fundamentals VII: Pick the Right Library

OpenCV

  • OpenCV
  • OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in commercial products.

PDFs with Python

  • PDF Merger
  • PDF Watermarker

Sending Emails with Python

Password Checker Project

Twitter Project

SMS with Python

  • Twilio
    • Your new Phone Number is +16102981505

Section 18: Scraping Data with Python

Hacker News Project

Section 19: Web Development with Python

$ export FLASK_APP=hello.py
$ flask run
 * Running on http://127.0.0.1:5000/

Building a Portfolio

HTML Templates

Deploying Project

Section 20: Automation Testing with Selenium

Section 21: Machine Learning + Data Science

  • AI, Machine Learning, Deep Learning, Data Science
  • Machine Learning:
    • given input and output, the computer creates the function to manifest the desired output
      • functions, algorithms, models, brains, bots
  • History of Data
    • spreadsheets
    • Relational DB
    • "Big Data" NoSQL e.g., mongoDB
    • Machine Learning
  • Types of Machine Learning
    • Supervised
      • Classification: e.g., apples or pears
      • Regression: e.g., track stock market prices
    • Unsupervised
      • Clustering: creating groups out of data points
      • Association Rule Learning: associate different things to make predictions (as to what a customer might buy in the future)
    • Reinforcement
      • skill acquisition
      • real time learning

Machine Learning 101

The Facebook Field Guide to Machine Learning

Tools in Machine Learning

Data Science Project

Machine Learning Steps

  1. Import the data - from kaggle.com
  2. Clean the data - pandas
  3. Split the data: training set, test set (80/20)
  4. Create a Model
  5. Check the output
  6. Improve

Machine Learning Project

models

Finished course on Saturday, February 1, 2020

python's People

Contributors

hyosung11 avatar

Stargazers

 avatar Emilio17MC avatar Julio Ruiz  Aka. Julio Krack avatar  avatar Gina Beki avatar Eric9400 avatar  avatar  avatar Maciej Bąk avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.