Foundation · PY-101 · Python Academy
Python Core: learn Python by running it
Every Python fundamental in one course: basics, control flow, functions, collections, strings, files, errors, modules, OOP, generators and testing. Each topic comes alive, then you practise it live.
- Free
- Beginner friendly
- 60 lessons
- 300 questions
- No install needed
- 🏆 Certificate
Updated December 2026 · Python 3 · English · by Suthahar Jegatheesan
What you'll learn
- Write, run and debug Python programs with confidence
- Control flow with conditions and loops, and write reusable functions
- Choose and use lists, tuples, sets and dictionaries, including comprehensions
- Read and write files, handle errors and organise code into modules
- Model real things with classes, inheritance and dataclasses
- Use iterators, generators, decorators and type hints, and test your code with pytest
Try it right now
This is the editor you get in every lesson. Press Run.
Input one line per input() call
Press Run to see the output. Python runs in your browser. Who this course is for
Complete beginners
Never written a line of code? Lesson 1 starts at zero.
AI tool users
You use ChatGPT or Copilot to write Python and want to understand what it gives you.
Students
School, college or university: build the base for data, AI and software jobs.
Career changers
Testers, analysts and admins adding automation to their work.
Course curriculum
Every lesson has the same flow: a 30-second answer, then Try it (live code, visualiser and a challenge), a story, an explanation, a pro tip and a quiz.
14 modules · 60 lessons · 300 practice questions
Module 1: Getting started with Python
- What is Python? Python is a general-purpose programming language that reads almost like plain English.
- print() and your first program print() is the built-in Python function that shows values on the screen.
- Comments A comment is text in your code that Python ignores.
Module 2: Variables and data types
- Variables A variable is a name that points to a value, such as age = 25.
- Data types A data type tells Python what kind of value something is and what you can do with it.
- Type conversion Type conversion, also called casting, turns a value into another type with int(), float(), str() or bool().
Module 3: Operators
- Arithmetic operators Arithmetic operators do maths on numbers: + - * and / work as you expect, // divides and drops the remainder, % gives the remainder, and ** raises to a power.
- Comparison and logical operators Comparison operators such as ==, !=, < and >= compare two values and give True or False.
Module 4: Strings and input
- Strings and f-strings A string is text, stored as a sequence of characters you can index and slice.
- User input and Lab 01: Calculator input() pauses the program, shows a prompt and returns what the user typed, always as a string.
Module 5: Conditions
- if, elif and else An if statement runs a block of code only when its condition is True.
- Nested conditions A nested condition is an if inside another if, so the inner check only happens when the outer one is True.
- match statements A match statement compares one value against a list of case patterns and runs the first one that fits.
Module 6: Loops
- for loops and range() A for loop runs a block once for each item in a sequence, such as a list, a string or a range of numbers.
- while loops A while loop repeats its block as long as its condition is True, checking before every round.
- break, continue and loop else break ends a loop immediately, continue skips the rest of the current round and goes to the next one.
- Nested loops A nested loop is a loop inside another loop: for every round of the outer loop, the inner loop runs all the way through.
Module 7: Functions
- Defining functions A function is a named block of code you can run whenever you need it, by calling its name with brackets.
- Parameters and return values Parameters are the names in a function's brackets that receive the values you pass in, called arguments.
- Default and keyword arguments A default value makes a parameter optional: def greet(name, greeting="Hello"): uses "Hello" unless you pass something else.
- *args and **kwargs *args collects any number of extra positional arguments into a tuple, and **kwargs collects any number of keyword arguments into a dictionary.
- Scope Scope is where a variable can be seen.
- Lambda functions A lambda is a small, unnamed function written in one line: lambda x: x * 2 takes x and returns x * 2.
- Recursion Recursion is when a function calls itself to solve a smaller version of the same problem.
Module 8: Collections
- Lists A list is an ordered collection of values in square brackets, such as ["tea", "milk"].
- Tuples A tuple is an ordered group of values in round brackets, such as (12.97, 77.59), that cannot be changed after it is made.
- Sets A set is an unordered collection of unique values in curly brackets, such as {"tea", "milk"}.
- Dictionaries A dictionary stores values under unique keys, written as {"name": "Asha", "age": 29}.
- Comprehensions A comprehension builds a new list, dict or set from another collection in one line: [x * 2 for x in nums].
- Unpacking Unpacking assigns the items of a sequence to several variables at once: name, age = ("Asha", 29).
- Sorting and searching sorted(items) returns a new sorted list, while items.sort() sorts the list in place.
Module 9: Strings in depth
- String methods String methods are built-in tools you call on any string with a dot, such as text.split() or name.startswith("Dr").
- Formatting numbers and dates Inside an f-string, a colon after a value adds a format spec: f"{price:,.2f}" gives 1,499.50 and f"{rate:.1%}" gives 12.5%.
- Slicing patterns A slice takes part of a string or list with [start:stop:step].
- Regular expressions basics A regular expression is a pattern that describes text, like \d+ for "one or more digits".
Module 10: Files and errors
- Reading and writing files open(name, mode) opens a file: "w" writes (replacing what was there), "a" appends to the end and "r" reads.
- with and context managers A with statement runs a block of code inside a context manager, which sets something up at the start and always cleans it up at the end, even if an error happens.
- CSV and JSON CSV stores rows and columns as text with commas, like a spreadsheet, and Python's csv module reads and writes it.
- try, except and finally try runs code that might fail; if it raises an exception, the matching except block handles it instead of the program crashing.
- Raising and custom exceptions raise stops a function and signals a problem, such as raise ValueError("amount must be positive").
Module 11: Modules and packages
- import and from import brings a module into your program, and you use its contents with a dot: import math, then math.sqrt(16).
- The standard library tour The standard library is the large set of modules that comes with Python, so you can use them without installing anything.
- pip and virtual environments pip installs packages from PyPI, such as pip install requests.
- if __name__ == "__main__" Every Python file has a built-in variable __name__.
Module 12: Object-oriented Python
- Classes and objects A class is a blueprint that describes a kind of thing, and an object is one actual thing made from that blueprint.
- __init__ and attributes __init__ is a special method that runs automatically when an object is created, and it sets up the object's attributes.
- Methods A method is a function defined inside a class.
- Inheritance Inheritance lets a new class (the child) start from an existing class (the parent) and get all its attributes and methods, written class Child(Parent):.
- Polymorphism Polymorphism means different classes can be used the same way because they share a method name, even though each does its own thing.
- Encapsulation Encapsulation means an object protects its own data and only lets the outside change it in controlled ways.
- Dunder methods Dunder methods are special methods with double underscores, like __str__ or __eq__, that Python calls for you in certain situations.
- Dataclasses A dataclass is a class mainly for holding data, created with the @dataclass decorator.
Module 13: Advanced Python
- Iterators An iterable is anything you can loop over, such as a list or a string.
- Generators A generator is a function that uses yield instead of return.
- Decorators A decorator is a function that takes another function and returns a new function that adds something before or after it, such as logging or a permission check.
- Type hints Type hints are optional notes that say what type a value should be, such as def total(prices: list[float]) -> float:.
Module 14: Testing and debugging
- Reading tracebacks A traceback is the report Python prints when an error stops your program.
- Debugging step by step Debugging is finding where the program's real behaviour first differs from what you expected.
- assert assert condition, "message" checks that a condition is True and raises AssertionError with your message if it is False.
- pytest basics pytest is Python's most popular testing tool: you write functions whose names start with test_, put plain asserts inside, and run pytest to execute them all and report which pass.
How you'll learn
Six ways to learn and check yourself, all free and all in your browser.
Live code
Every example is real Python 3 you can edit and run. No install, nothing leaves your browser.
Code comes alive
Every example plays as an animation: variables are jars, loops spin, functions are machines.
Challenges
A small task at the end of every lesson. Hidden tests tell you if you got it right.
Game lab
Steer a robot through mazes with Python. Each level needs one new idea.
Quizzes
Five questions after each lesson, with the reason behind every answer.
Practice exam
50 random questions, 60 minutes, explained afterwards.
Recommended learning sequence
- Step 1Read the answerEach lesson opens with a 30-second answer.
- Step 2Run itRun the example, change it, break it, fix it.
- Step 3Watch itSee the code come alive, line by line.
- Step 4Prove itSolve the challenge. The tests check your code.
- Step 5Pass the quiz4 of 5 right and the lesson is complete.
- Step 6Sit the examAim for 70% or more.
- Step 7Get your certificateDownload it as PDF and add it to LinkedIn.
Python Core Certificate
Earn a verifiable certificate
Finish PY-101 Python Core, pass the 50-question final exam with 70% or more, and get a certificate with your name, a certificate ID anyone can verify, a PDF to download and one click to add it to LinkedIn.
- 📄 PDF and PNG download
- 🔎 Verifiable ID and link
- in Add to LinkedIn
- 🏅 Shareable badge
Frequently asked questions
Is PY-101 Python Core free?
Yes. All 60 lessons, the live editor, the visualiser, the challenges, the game lab and the practice exam are free. No account is needed.
How long does PY-101 take?
About 8 to 40 hours: 60 lessons of roughly 8 minutes, plus the game lab and the practice exam. Twenty minutes a day finishes it in two to three weeks.
Do I need to install Python for PY-101?
No. Every lesson runs real Python 3 in your browser using Pyodide (CPython compiled to WebAssembly). Install Python from python.org later, when you build programs on your own computer.
Is the Python Core Certificate an official certification?
No. PY-101, AI-601, GD-301 and the other codes here are MSDEVBUILD course codes. They are not official Microsoft or Python Software Foundation certifications. It shows you finished the path and passed its practice exam.
What comes after Python Core?
Pick a roadmap: AI (data analytics, machine learning, AI agents), Developer (APIs, full-stack), Data, or Automation & Cloud. Every roadmap starts from Python Core.
Ready when you are
Lesson 1 takes about ten minutes. Your progress is saved in this browser as you go.