/practicing-python

Practicing Python by going through several (free and paid) courses

Primary LanguagePython

Practicing Python

Practicing Python by going through several (free and paid) courses

Table of Contents

Short(er) Python tutorials (do these first)

Long(er) Python tutorials

Intermediate Python tutorials

  • freeCodeCamp - Anil Kulkarni - Octallium - Learn Python by Thinking in Types - Full Course

  • Patrick Loeber - Intermediate Python Programming Course (IMPORTANT!)

    • 1. Lists (187K views, 4 years ago, 15:51)

    • 2. Tuples (44K views, 4 years ago, 13:31)

    • 3. Dictionaries (82K views, 4 years ago, 13:05)

    • 4. Sets (28K views, 4 years ago, 16:19)

    • 5. Strings (34K views, 4 years ago, 24:16)

    • 6. Collections (83K views, 4 years ago, 14:10)

    • 7. Itertools (47K views, 4 years ago, 15:23) [watch again]

    • 8. Lambda (44K views, 4 years ago, 12:21)

    • 9. Exceptions (22K views, 4 years ago, 16:20)

    • 10. Logging (50K views, 4 years ago, 22:29) [watch again]

    • 11. JSON (29K views, 4 years ago, 17:35)

    • 12. Random Numbers (10K views, 4 years ago, 14:57)

    • 13. Decorators (37K views, 4 years ago, 21:24)

    • 14. Generators (19K views, 4 years ago, 18:12)

    • 15. Threading vs Multiprocessing (41K views, 4 years ago, 14:48)

      DEFINITION: Process: An instance of a program (e.g. a Python interpreter, a web browser, a text editor)

      Advantages of processes:

      • Takes advantage of multiple CPUs and cores
      • Separate memory space, each process has its own memory ->> Memory is not shared between processes
      • Great for CPU-bound processing
      • New process is started independently from the first process (from other processes)
      • Processes are interruptible/killable
      • One GIL (Global Interpreter Lock) for each process -> avoids GIL limitation

      Disadvantages of processes:

      • Heavyweight
      • Starting a process is slower than starting a thread
      • More memory
      • IPC (Inter-process communication) is more complicated

      DEFINITION: Thread: An entity within a process that can be scheduled (for execution) (also known as a lightweight process) A process can spawn multiple threads

      Advantages of threads:

      • All threads within a process share the same memory
      • Lightweight
      • Starting a thread is faster than starting a process
      • Great for I/O-bound tasks (When our program has to talk to slow devices like talking to a hard drive, a network connection, a database...our program can use the time waiting for these devices and then intelligently switch to another thread to do something else).

      Disadvantages of threads:

      • Threading is limited by GIL: Only one thread can execute Python code at once (even on a multi-core processor) so there is no actual parallelism
      • NOTE: No effect for CPU-bound tasks (like math calculations, image and video processing etc.) because of GIL
      • Not interruptible/killable
      • Careful with race conditions (when two or more threads try to modify the same variable at the same time - this can cause unexpected behavior, bugs or crashes)

      DEFINITION: GIL (Global Interpreter Lock): A lock that allows only one thread at a time to execute in Python (even on a multi-core processor)

      • It is needed because CPython (the reference implementation of Python) is not thread-safe. -> That means that multiple threads can't execute Python bytecodes at once.
      • It is a performance bottleneck in CPU-bound tasks (like math calculations, image and video processing etc.)
      • It is not a problem for I/O-bound tasks (like talking to a hard drive, a network connection, a database, a web server etc.)
      • It is not a problem for multi-threaded C extensions (like NumPy, Pandas, OpenCV etc.)

      If we want to avoid the GIL but still want to use parallel computing we can use:

      • multiprocessing module (for CPU-bound tasks)
      • use a different, free-threaded Python implementation (like Jython, IronPython, PyPy)
      • use Python as a wrapper for third-party libraries (like C++ libraries) -> this is how NumPy, Pandas, OpenCV etc. work
      • asyncio module (for I/O-bound tasks) TODO: check this
      • concurrent.futures module (for both CPU-bound and I/O-bound tasks) TODO: check this

      QUESTION: Why is the GIL needed?
      A GIL is needed because in CPython there is a memory management that is not thread-safe. So, in CPython there is a technique called reference counting that is used to manage memory. This means that objects created in Python have a reference count variable that keeps track of the number of references that point to the object. When this count reaches zero, the memory occupied by the object is released. The problem now in multi-threading is that this reference count variable needs protection from race conditions where two threads increase or decrease the value simultaneously. So, if this happens it can either cause leaked memory that is never released or it can incorrectly release memory (that is still in use) while the reference to that object still exists. This is the reason why CPython has a GIL.

    • 16. Threading (43K views, 4 years ago, 23:42)

    • 17. Multiprocessing (48K views, 4 years ago, 22:47)

    • 18. Function arguments (39K views, 4 years ago, 24:21)

    • 19. The asterisk (*) operator (21K views, 4 years ago, 13:01)

    • 20. Shallow vs Deep Copying (18K views, 4 years ago, 9:56)

    • 21. Context Managers (17K views, 4 years ago, 15:44)

  • Great learning - Data Structures & Algorithms (playlist) - check quality

    14 videos 29,734 views Last updated on 29 Nov 2022

    NOTE: Several videos are about Python (others are in C and Java)

Advanced Python tutorials

Python design patterns, SOLID principles, refactoring, best practices, good code architecture

Data structures and algorithms

  • freeCodeCamp - Aakash - Jovian - Data Structures and Algorithms in Python - Full Course for Beginners
  • Kantan Coding - Learn Tree Traversal Algorithms By Building A Python CLI App
    • 1. Python Algorithms Tutorial: CLI App Part 1 - App Skeleton (2.1K views, 3 years ago, 14:42)
    • 2. Python Algorithms Tutorial: CLI App Part 2 - Queue, Binary Tree, Level Order Traversal (646 views, 3 years ago, 27:48)
    • 3. Python Algorithms Tutorial: CLI App Part 3 - BFS Breadth First Search, DFS Depth First Search (442 views, 3 years ago, 33:42)
    • 4. Python Algorithms Tutorial: CLI App Part 4 - DFS Depth First Search In-Order, Post-Order (328 views, 3 years ago, 22:11)
    • 5. Python Algorithms Tutorial: CLI App Part 5 - Binary Search Tree, Binary Search (329 views, 3 years ago, 32:52)
    • 6. Python Algorithms Tutorial: CLI App Part 6 - Packaging & Installing (393 views, 2 years ago, 8:10)
  • Kantan Coding -
    • 1. Data Structures for Python Developers (Flask API) #1: Intro & Setup (3.8K views, 3 years ago, 5:35)
    • 2. Data Structures for Python Developers (Flask API) #2: Database & API Skeleton (1.9K views, 3 years ago, 24:34)
    • 3. Data Structures for Python Developers (Flask API) #3: Linked List (1.4K views, 3 years ago, 45:10)
    • 4. Data Structures for Python Developers (Flask API) #4: Linked List Continued (675 views, 3 years ago, 18:21)
    • 5. Data Structures for Python Developers (Flask API) #5: Hash Table (713 views, 3 years ago, 24:36)
    • 6. Data Structures for Python Developers (Flask API) #6: Hash Table Continued (424 views, 3 years ago, 12:01)
    • 7. Data Structures for Python Developers (Flask API) #7: Binary Search Tree (647 views, 3 years ago, 34:12)
    • 8. Data Structures for Python Developers (Flask API) #8: Stacks and Queues (708 views, 3 years ago, 33:01)

Roadmaps

  • fozilbek - How To Master Python - Python for Beginners Roadmap

    • Introduction:
      • ...
    • Basic:
      • strings and characters (text)
      • numbers, dates and times
      • data manipulation
      • functions
    • OOP:
      • essence of OOP
      • objects
      • classes
      • abstraction
      • encapsulation
      • operator overloading
      • inheritance
      • abstract class/method
      • polymorphism
      • modules - packages
      • object types & protocols
    • Data structures:
      • array
      • list
      • tuples
      • sets
      • dictionaries
      • ADT
      • stack
      • queue
      • map
      • file I/O
      • data encoding & processing
    • Algorithms:
      • algorithms intro
      • complexities
      • Big(O)
      • sorting
      • searching
      • dynamic programming
      • testing & debugging
      • exceptions
      • built-in functions & algorithms
      • standard library
    • Control flow:
      • iterators && generators
      • context managers
      • coroutines
      • concurrency && parallelism
    • Metaprogramming:
      • properties
      • attribute desciptors
      • decorators
      • metaclasses
    • Advanced:
      • utility scripting
      • system administration
      • network & web programming
    • Problem solving:
      • Leetcode
      • Codewars
    • Books:
      • Python Cookbook (David Beazley) (NOTE: this is an older version of "Python Distilled" it seems)
      • Python Distilled
      • Fluent Python
      • Effective Python
  • Alex Hyett - Programming for Beginners

    • 1. Backend Developer Roadmap - Everything you need to know in 2023 (41K views, 4 months ago, 6:52)
    • 2. Stack vs Heap Memory - Simple Explanation (37K views, 8 months ago, 5:28)
    • 3. Bitwise Operators and WHY we use them (11K views, 9 months ago, 8:41)
    • 4. Git Flow vs GitHub Flow: What You Need to Know (5.6K views, 9 months ago, 6:16)
    • 5. SOLID Principles: Do You Really Understand Them? (4.7K views, 2 months ago, 7:04)
    • 6. 8 DATA STRUCTURES You NEED to Know (3.9K views, 9 months ago, 10:50)
    • 7. 5 Types of Testing Software Every Developer Needs to Know! (3.4K views, 5 months ago, 6:24)
    • 8. Top 5 Programming Languages to Learn in 2023 (to Get a Job) (1.4K views, 5 months ago, 5:23)
    • 9. Binary Numbers: What Every Developer Should Know (but doesn't) (1.2K views, 10 months ago, 6:58)
    • 10. What is Big O Notation, and Why You Should Care (1.2K views, 8 months ago, 7:30)
    • 11. This is a Better Way to Understand Recursion (905 views, 3 months ago, 4:03)
    • 12. Bad at MATH? Can you be a Software Developer? (853 views, 10 months ago, 4:58)
    • 13. The BEST Programming Language to Learn as a Beginner in 2023 (740 views, 10 months ago, 4:17)
    • 14. 6 Coding Concepts You MUST Know For Beginners (575 views, 10 months ago, 5:31)
    • 15. How I would learn to code in 2023 (if I could start over) (509 views, 7 months ago, 6:00)
    • 16. Finally Understand Regular Expressions - In Just 7 Minutes! (497 views, 7 months ago, 7:26)
    • 17. CRUD Operations are Everywhere: DB and REST API Examples (445 views, 6 months ago, 4:31)
    • 18. Why You Struggle to Learn to Code (and How To Fix It) (254 views, 6 months ago, 4:28)

Books

  • Think Python: How to Think Like a Computer Scientist - Allen B. Downey (2024, 3rd edition, 320 pages, O'Reilly Media) (NOTE: not published yet)
  • Effective Python: 135 Specific Ways to Write Better Python - Brett Slatkin (March 28. 2024, 3rd edition, Addison-Wesley Professional) (NOTE: not published yet)
    • previous version had 4.7 stars from 408 ratings on Amazon
  • Python Crash Course - Eric Matthes (2023, 3rd edition, 552 pages, No Starch Press)
    • 4.7 stars from 754 ratings on Amazon
  • Fluent Python - Luciano Ramalho (2022, 2nd edition, 1012 pages, O'Reilly Media)
    • 4.7 stars from 375 ratings on Amazon
  • Python Distilled - David Beazley (2021, 1st edition, 352 pages, Pearson) (NOTE: can be used as a reference book)
    • 4.7 stars from 177 ratings on Amazon
  • Automate the Boring Stuff with Python - Al Sweigart (2019, 2nd edition, 592 pages, No Starch Press)
    • 4.7 stars from 3,094 ratings on Amazon
  • The Big Book of Small Python Projects: 81 Easy Practice Programs - Al Sweigart (2021, 1st edition, 432 pages, No Starch Press)
    • 4.6 stars from 196 ratings on Amazon
  • Impractical Python Projects - Lee Vaughan (2018, Illustrated edition, 424 pages, No Starch Press)
    • 4.7 stars from 337 ratings on Amazon
  • Python Programming: An Introduction to Computer Science - John Zelle (2016, 3rd edition, 552 pages, Franklin, Beedle & Associates Inc)
    • 4.6 stars from 411 ratings on Amazon

Python modules, libraries, frameworks

  • Tech With Tim - Top 18 Most Useful Python Modules

    • I Web Development:

      • Requests (HTTP requests; API; web scraping)
      • NOTE: I would add FastAPI
      • Django
      • Flask
      • Twisted (networking; web servers; chat servers; game servers)
      • BeautifulSoup (web scraping)
      • Selenium (web automation)
    • II Data Science:

      • Numpy
      • Pandas
      • Matplotlib
      • Nltk (natural language toolkit)
      • opencv
    • III Machine Learning & AI:

      • NOTE: I would add PyTorch
      • TensorFlow
      • Keras
      • Sci-kit learn
    • IV GUI:

      • kivy
      • PyQt5 [likely the best]
      • Tkinter
      • Pygame [does not fit any category]
    • Bitfumes - FastAPI - A python framework | Full Course

Automation, web crawling, web scraping, web automation

  • Tech With Tim (playlist) - Beautiful Soup 4 Tutorial

    4 videos 60,082 views Last updated on 18 Sept 2021

    Learn how to web scrape using Beautiful Soup 4 and Python!

    • 1. Beautiful Soup 4 Tutorial #1 - Web Scraping With Python (428K views, 2 years ago, 17:01)
    • 2. Beautiful Soup 4 Tutorial #2 - Searching and Filtering (121K views, 2 years ago, 11:5)
    • 3. Beautiful Soup 4 Tutorial #3 - Navigating The HTML Tree (70K views, 2 years ago, 12:5)
    • 4. Beautiful Soup 4 Tutorial #4 - Finding The Best GPU Prices (65K views, 2 years ago, 27:4)
  • Tech With Tim (playlist) - Python Selenium Tutorials

    6 videos 682,056 views Last updated on 24 May 2020

    This python selenium tutorial is designed to teach you how to do website automation with python! This includes web scraping, creating bots and much more...

    • 1. Python Selenium Tutorial #1 - Web Scraping, Bots & Testing (1.3M views, 3 years ago, 11:41)
    • 2. Python Selenium Tutorial #2 - Locating Elements From HTML (662K views, 3 years ago, 16:12)
    • 3. Python Selenium Tutorial #3 - Page Navigating and Clicking Elements (392K views, 3 years ago, 8:18)
    • 4. Python Selenium Tutorial #4 - ActionChains & Automating Cookie Clicker! (209K views, 3 years ago, 13:45)
    • 5. Python Selenium Tutorial #5 - UnitTest Framework (Part 1) (143K views, 3 years ago, 18:50)
    • 6. Python Selenium Tutorial #6 - UnitTest Framework (Part 2) (82K views, 3 years ago, 19:15)

Playlists with various tutorials

  • Patrick Loeber - Crash Courses
    • Object Oriented Programming (OOP) In Python - Beginner Crash Course
    • NumPy Crash Course - Complete Tutorial
    • Python Flask Beginner Tutorial - Todo App - Crash Course
    • Regular Expressions in Python - FULL COURSE (1 HOUR) - Programming Tutorial
    • HuggingFace Crash Course - Sentiment Analysis, Model Hub, Fine Tuning

Suggestions for a better code

Notes

  • NOTE: Avoid importing everything from a module (e.g. from module import *)

Better Python code (Advices, Pydantic etc.)

Language agnostic suggestions for better code

Python interview

Advices about how to learn Python

Python interview preparation

Python interview questions

Python project ideas

NOTE: I'll do the most interesting ones

Python game ideas (PyGame)

  • Tech With Tim
    • Tim has lots of tutorials for making games
  • Goodgis - Making a Game in Python with No Experience
  • ButWhyLevin - Best Python Game Wins $10,000! - Kajam Game Jam
  • DaFluffyPotato -

    12 videos 16,075 views Last updated on 17 Jul 2023

    Check out the Advanced playlist for even more topics: https://www.youtube.com/playlist?list=PLX5fBCkxJmm3s5GL0Cebm59m1GkAhCFoM

    • 1. How to ACTUALLY get into Gamedev (575K views, 2 years ago, 14:01)
    • 2. Pygame Platformer Tutorial - Full Course (161K views, 6 months ago, 6:05:12)
    • 3. Pygame's Performance - What You Need to Know (174K views, 2 years ago, 9:11)
    • 4. Free Gamedev Tools I Use (165K views, 4 years ago, 9:00)
    • 5. Flipping, Rotating, Scaling, & Resizing - Pygame Tutorial (29K views, 3 years ago, 4:28)
    • 6. Menus - Pygame Tutorial (160K views, 3 years ago, 7:37)
    • 7. Framerate Independence - Pygame Tutorial (20K views, 3 years ago, 3:33)
    • 8. Custom Text System in Pygame (12K views, 3 years ago, 9:41)
    • 9. Fullscreen & Resizing - Pygame Tutorial (52K views, 3 years ago, 8:00)
    • 10. How to Code (almost) Any Feature (551K views, 3 years ago, 9:48)
    • 11. Pygame CE - Better & Faster (23K views, 8 months ago, 6:29)
    • 12. Trigonometry in Game Development (49K views, 3 years ago, 11:26)

Python game engines

Python automation project ideas

General

General conference talks

General advice

Mathematics

Math with Python

  • (playlist) Mr. P Solver - The Full Python Tutorial

    20 videos 67,841 views Last updated on 12 Feb 2023

    • Basics of Python: Part 1 - Introduction
    • Basics of Python: Part 2 - Lists, Tuples, Arrays
    • Basics of Python: Part 3 - Loops, If Statements
    • Basics of Python: Part 4 - Sample Problems
    • NumPy Tutorial (2022): For Physicists, Engineers, and Mathematicians
    • SciPy Tutorial (2022): For Physicists, Engineers, and Mathematicians
    • Matplotlib Tutorial (2022): For Physicists, Engineers, and Mathematicians
    • SymPy Tutorial (2022): For Physicists, Engineers, and Mathematicians
    • 1st Year Calculus, But in PYTHON
    • 2nd Year Calculus, But in PYTHON
    • Derivatives In PYTHON (Symbolic AND Numeric)
    • Integration in PYTHON (Symbolic AND Numeric)
    • How to Solve Differential Equations in PYTHON
    • All Types of Fourier Transforms in PYTHON
    • How To Interpolate Data In Python
    • Curve Fitting in Python (2022)
    • How to: Monte Carlo Simulation in Python (Introduction)
    • Spectral Analysis in Python (Introduction)
    • You Should Be Using This For Work/Research in Python | OOP Tutorial
    • SciPy curve_fit: What is "pcov"?

Mathematics advice

Various courses

  • (playlist) Bro Code - Full Courses (Python, JAVA, C++, C#, C, Data Structures and Algorithms...)
  • (playlist) pixegami - Python Tutorials
    • 1. Why You Should Learn Python in 2023 (as your first programming language) (4K views,1 months ago, 14:33)
    • 2. How To Write Unit Tests in Python • Pytest Tutorial (106K views, year ago, 35:34)
    • 3. PyTest • REST API Integration Testing with Python (53K views, year ago, 37:24)
    • 4. How to Make a Discord Bot with Python (33K views, year ago, 29:17)
    • 5. Host a Python Discord Bot on AWS Lambda (Free and Easy) (3.8K views, 4 months ago, 21:40)
    • 6. Pydantic Tutorial • Solving Python's Biggest Problem (141K views, months ago, 11:07)
    • 7. Python FastAPI Tutorial: Build a REST API in 15 Minutes (10K views, months ago, 15:16)
    • 8. Python Requests Tutorial: HTTP Requests and Web Scraping (934 views, months ago, 13:41)
    • 9. ChatGPI API in Python - How to Build a Custom AI Chat App (2.4K views, 9 months ago, 25:29)
    • 10. Build Wordle in Python • Word Game Python Project for Beginners (20K views, year ago, 58:57)
    • 11. How to Send SMS Text Messages with Python & Twilio - Quick and Simple! (10K views, year ago, 10:54)
    • 12. FastAPI Python Tutorial - Learn How to Build a REST API (7.6K views, 1 year ago, 41:20)
    • 13. How I Would Learn Python (if I had to start over) • A Roadmap for 2023 (6.2K views, 11 months ago, 19:28)
    • 14. Top 10 Python Modules 2022 (4.5K views, 1 year ago, 8:14)
    • 15. Decorators in Python: How to Write Your Own Custom Decorators (3.6K views, 1 year ago, 10:12)
    • 16. Python Web Scraping Tutorial • Step by Step Beginner's Guide (4.7K views, 1 year ago, 28:21)
    • 17. How to create 1000+ unique NFT-style images (like Cryptopunk) | Python Tutorial (19K views, year ago, 50:43)
    • 18. Python Beginner Project: Build a Caesar Cipher Encryption App (4.5K views, 1 year ago, 25:10)
    • 19. PyScript • How to run Python in a browser (4.2K views, 1 year ago, 6:42)
    • 20. How to Publish a Python Package to PyPI (pip) (1.6K views, 2 months ago, 11:38)
    • 21. Langchain: The BEST Library For Building AI Apps In Python? (1.6K views, 2 months ago, 11:41)
    • 22. Streamlit: The Fastest Way To Build Python Apps? (7.5K views, 1 month ago, 11:57)
    • 23. Python Dataclasses: Here's 7 Ways It Will Improve Your Code (2K views, month ago, 9:34)

Good YouTube Channels

  • Clear Code
  • CodeAestetic
  • MollyRocket
  • Programming with Mosh
  • Coderized
  • (add more)

Platform to practice coding on

Platforms for learning (coding, math etc.)

Free:

Paid (or mostly):

Also check out

  • middle and advanced level
  • data structures
  • algorithms
  • best practices
  • crash course
  • george hotz (and his dabbling with biotech data for example)