Free Online Course · Self-paced

Python Tutorial for Beginners (Hands-On)

Free, complete Python tutorial for beginners - variables, strings, lists, dicts, control flow, OOP, file I/O, error handling, regex, concurrency, and Flask web apps. 70+ runnable lessons covering Python 3.10+.

  • 111 parts
  • ~1245 min total
  • Beginner to Intermediate
  • Updated May 2026
Python Tutorial for Beginners (Hands-On)
By Last updated

Python is the most-taught programming language in the world for good reason: it reads like pseudocode, scales from one-line scripts to massive ML systems, and has a battery-included standard library that covers 90% of common tasks. This tutorial takes you from variables and print() all the way to running Flask web apps - the long way around, with every fundamental covered.

We start with functions and basic syntax, then walk through every data type Python ships (strings, numbers, lists, tuples, sets, dicts), control flow, OOP (classes, dataclasses, inheritance), error handling, file I/O (CSV, JSON, YAML, ZIP), regex, subprocesses, concurrency (threading + multiprocessing), and finally a complete Flask web app. Every chapter is short, every snippet is runnable in the Python REPL, and every example was tested on Python 3.11+.

Click Start the course to begin with the getting-started chapter, or jump to the topic you need - Lists, Tuples and Sets, Dictionaries, and Object-Oriented Python are the most-bookmarked. If you finish this course and want to specialize, the next courses are /pandas-tutorial/ (data analysis) and /python-pandas-tutorial/ (deeper Pandas).

What you'll learn

  • Write idiomatic Python using variables, strings, numbers, and operators correctly
  • Use the four core collections (list, tuple, set, dict) and pick the right one for each job
  • Master control flow - if/else, ternary, match/case, for/while loops, comprehensions
  • Build functions, classes, dataclasses, and use inheritance / generators / decorators
  • Read and write files (CSV, JSON, YAML, ZIP), call subprocesses, and parse arguments
  • Handle errors, log properly, and use multithreading / multiprocessing
  • Build your first Flask web application

Prerequisites

  • Python 3.10+ installed locally (3.11 or 3.12 recommended)
  • Comfortable on the command line
  • Any code editor (VS Code or PyCharm Community recommended)

Syllabus

15 chapters · 111 lessons · ~1245 min of reading

  1. 1 Getting Started 7 lessons
    1. Part 1 Beginner tips for learning Python 7 min read
    2. Part 2 Python functions explained 10 min read
    3. Part 3 Call functions in Python 9 min read
    4. Part 4 Lambda (anonymous) functions 11 min read
    5. Part 5 Create and publish a Python package 19 min read
    6. Part 6 requirements.txt - manage dependencies 5 min read
    7. Part 7 Install a package directly from GitHub 4 min read
  2. 2 Variables, Numbers, Strings 13 lessons
    1. Part 8 Check the type of a variable 13 min read
    2. Part 9 Print variables (f-strings and beyond) 8 min read
    3. Part 10 Python numbers - int, float, complex 6 min read
    4. Part 11 String formatting (f-strings, format(), %) 14 min read
    5. Part 12 Concatenate strings 6 min read
    6. Part 13 Extract a substring 10 min read
    7. Part 14 Split a string 5 min read
    8. Part 15 Check if a string contains a substring 21 min read
    9. Part 16 str.startswith() method 8 min read
    10. Part 17 str.strip() and friends 8 min read
    11. Part 18 Reverse a string 9 min read
    12. Part 19 Compare strings 6 min read
    13. Part 20 Multi-line strings 8 min read
  3. 3 Operators, Conditions, Pattern Matching 6 lessons
    1. Part 21 Python operators (arithmetic, comparison, logical, bitwise) 19 min read
    2. Part 22 if / elif / else 14 min read
    3. Part 23 One-line if/else 9 min read
    4. Part 24 Ternary operator 18 min read
    5. Part 25 switch/case equivalents in Python 9 min read
    6. Part 26 match / case (structural pattern matching) 20 min read
  4. 4 Loops and Iteration 12 lessons
    1. Part 27 for loop 14 min read
    2. Part 28 One-line for loops (comprehensions) 14 min read
    3. Part 29 while loop 10 min read
    4. Part 30 while with multiple conditions 6 min read
    5. Part 31 Loop N times 7 min read
    6. Part 32 Loop through lists 16 min read
    7. Part 33 break statement 7 min read
    8. Part 34 continue statement 7 min read
    9. Part 35 pass statement 11 min read
    10. Part 36 pass vs break vs continue 4 min read
    11. Part 37 range() function 13 min read
    12. Part 38 enumerate() 16 min read
  5. 5 Lists, Tuples and Sets 16 lessons
    1. Part 39 Python lists explained 12 min read
    2. Part 40 list vs set vs tuple vs dictionary 6 min read
    3. Part 41 list.pop() 11 min read
    4. Part 42 list.extend() 6 min read
    5. Part 43 append() vs extend() 6 min read
    6. Part 44 Remove elements from a list 9 min read
    7. Part 45 Concatenate lists 6 min read
    8. Part 46 Flatten a nested list 9 min read
    9. Part 47 Sort a list 10 min read
    10. Part 48 Copy a list (shallow vs deep) 8 min read
    11. Part 49 Python tuples 9 min read
    12. Part 50 Python sets 9 min read
    13. Part 51 Add to a set 6 min read
    14. Part 52 Set intersection 15 min read
    15. Part 53 Set difference 9 min read
    16. Part 54 Set symmetric difference 14 min read
  6. 6 Dictionaries 8 lessons
    1. Part 55 Python dictionaries explained 13 min read
    2. Part 56 Add to a dictionary 7 min read
    3. Part 57 Extend a dictionary 3 min read
    4. Part 58 Nested dictionaries 12 min read
    5. Part 59 Sort a dict by key 7 min read
    6. Part 60 Sort a dict by value 6 min read
    7. Part 61 Remove a key from a dict 7 min read
    8. Part 62 Merge two dicts 6 min read
  7. 7 Functions and Arguments 5 lessons
    1. Part 63 Call a function from another file 5 min read
    2. Part 64 Return multiple values from a function 16 min read
    3. Part 65 Optional arguments and defaults 13 min read
    4. Part 66 *args and **kwargs 19 min read
    5. Part 67 yield and generators 13 min read
  8. 8 Functional Tools and Comprehensions 4 lessons
    1. Part 68 List comprehensions 11 min read
    2. Part 69 map() function 14 min read
    3. Part 70 filter() function 14 min read
    4. Part 71 zip() function 14 min read
  9. 9 Object-Oriented Python 7 lessons
    1. Part 72 Define a class 17 min read
    2. Part 73 Constructors (__init__) 14 min read
    3. Part 74 @classmethod 10 min read
    4. Part 75 @staticmethod 12 min read
    5. Part 76 super() and inheritance 9 min read
    6. Part 77 @dataclass 13 min read
    7. Part 78 Enum types 13 min read
  10. 10 Error Handling and Logging 5 lessons
    1. Part 79 try / except basics 17 min read
    2. Part 80 Catch multiple exceptions 9 min read
    3. Part 81 Custom exceptions 16 min read
    4. Part 82 Exit a script cleanly 8 min read
    5. Part 83 The logging module 13 min read
  11. 11 File I/O 11 lessons
    1. Part 84 Check if a file exists 6 min read
    2. Part 85 Write to a file 15 min read
    3. Part 86 writelines() method 8 min read
    4. Part 87 Delete a file 9 min read
    5. Part 88 Read and write CSV 13 min read
    6. Part 89 Read YAML into a dict 6 min read
    7. Part 90 os.path.join() 6 min read
    8. Part 91 Create nested directories 5 min read
    9. Part 92 Get a file's extension 11 min read
    10. Part 93 Get a file's size 5 min read
    11. Part 94 Work with zip archives 22 min read
  12. 12 Regex, Dates and Utilities 5 lessons
    1. Part 95 Python regex (re module) 7 min read
    2. Part 96 datetime basics 18 min read
    3. Part 97 Convert datetime to timestamp 5 min read
    4. Part 98 Generate UUIDs 8 min read
    5. Part 99 Measure execution time 4 min read
  13. 13 Subprocess, CLI and HTTP 6 lessons
    1. Part 100 argparse - parse CLI arguments 23 min read
    2. Part 101 Read user input 14 min read
    3. Part 102 Run shell commands 13 min read
    4. Part 103 subprocess module 16 min read
    5. Part 104 HTTP requests with the requests library 19 min read
    6. Part 105 Progress bars in the terminal 28 min read
  14. 14 Concurrency 2 lessons
    1. Part 106 Multithreading in Python 19 min read
    2. Part 107 Multiprocessing in Python 22 min read
  15. 15 Web with Flask 4 lessons
    1. Part 108 Build a Flask web app 21 min read
    2. Part 109 Flask Jinja2 templates 12 min read
    3. Part 110 Flask + SQLAlchemy 21 min read
    4. Part 111 Deploy Flask with Gunicorn + Nginx 12 min read
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, …

  • Red Hat Certified System Administrator in Red Hat OpenStack
  • Certified Kubernetes Application Developer (CKAD)
  • Red Hat Certified Specialist in Ansible Automation
  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security