Free courseBeginner

Python A2Z: Foundations

Start from zero and write real Python programs: every data type, decisions and loops, functions, errors, files, modules, the standard…

Level
Beginner
Modules
115
Time
About 14 hours
Ends with
Certificate

Course path

Part 1 of the Python A2Z series for adult self-learners. Short lessons, each with runnable examples you can edit in the browser, a prediction, and a hands-on task you check yourself. Covers teachable concepts from a complete reference tutorial; non-teaching index, example, exercise, quiz, how-to and learning-resource pages are mapped to concepts or excluded.

  1. Choose Python for a practical automation task

    A repeatable calculation turns a small instruction sequence into useful automation.

    5 min

  2. Run and edit your first Python program in the browser

    The browser editor runs a short program and shows the result of each edit.

    6 min

  3. Install Python and run a file on Windows, macOS, or Linux

    A saved .py file runs through a local Python interpreter from its containing folder.

    8 min

  4. Try an expression at the Python prompt

    The prompt evaluates one entry at a time, while history and completion reduce retyping.

    7 min

  5. Display a text message

    Print sends text and computed values to the output panel with controllable separators.

    7 min

  6. Run Python source with the right text encoding

    UTF-8 source preserves readable messages, while comments explain decisions outside quoted text.

    6 min

  7. Trace an error message to its source line

    Error messages distinguish code that cannot be parsed from a failure during execution.

    8 min

  8. Find and fix a bug with a repeatable debugging step

    A reproducible input and a narrow hypothesis make a wrong result easier to investigate.

    6 min

  9. Store a value in a named variable

    Assignment gives a value a readable name, and reserved words cannot serve as names.

    7 min

  10. Assign several related values at once

    Multiple assignment binds several names together, while chained assignment shares one value.

    6 min

  11. Choose the right built-in value type

    A value's type determines its operations, and None records the absence of a result.

    7 min

  12. Represent whole and decimal quantities

    Integer and floating-point arithmetic calculate quantities with distinct division and remainder rules.

    8 min

  13. Write numbers in other forms

    Exponent notation, base prefixes and unary signs give ordinary numeric values alternative spellings.

    8 min

  14. Read text from a user

    Input arrives as text and must be converted before numeric calculation.

    7 min

  15. Explain a rounding surprise in floating-point arithmetic

    Binary floating-point approximations explain small differences between calculated and expected decimals.

    7 min

  16. Update a value with an assignment operator

    Augmented assignment calculates from the current value and then updates its binding.

    6 min

  17. Represent and inspect text

    Strings are immutable character sequences whose literals can include escaped characters.

    7 min

  18. Join text with the concatenation operator

    Concatenation and repetition build a new string from existing pieces.

    6 min

  19. Extract part of a string with a slice

    Slices select a range with an excluded stop, and a negative step can reverse its traversal.

    7 min

  20. Clean text without changing the original string

    String cleanup returns a new value, so keeping the result is part of the operation.

    6 min

  21. Choose a string method for a text cleanup task

    A grouped method reference helps select text searches, transformations, splits and validations.

    8 min

  22. Format a message with an f-string

    An f-string embeds expressions and controls the presentation of amounts and labels.

    7 min

  23. Format fields with str.format

    Existing code may fill format fields or percent placeholders to construct the same message.

    8 min

  24. Format text by assembling parts explicitly

    Explicit conversion and alignment can assemble a small report without an interpolation expression.

    6 min

  25. Make a script easier to read with consistent style

    Consistent names, spacing and small expressions make reporting code easier to scan.

    6 min

  26. Prepare text for a fixed-width export

    Alignment, tab expansion, translation and encoding support precise text exports without changing the source string.

    8 min

  27. Represent a true-or-false result

    Comparisons produce Boolean values that express checkable conditions.

    7 min

  28. Combine true-or-false tests

    And, or and not combine conditions into a precise acceptance rule.

    7 min

  29. Check whether two names refer to the same object

    Identity asks about the same object, while membership asks whether a value occurs within another value.

    7 min

  30. Predict how Python groups an expression

    Precedence controls grouping, while integer bit operators combine individual binary positions.

    8 min

  31. Check a label against a text rule

    Character-test methods express distinct Unicode-aware rules rather than one universal definition of valid text.

    8 min

  32. Run a block only when a condition is true

    An if statement conditionally executes an indented suite of statements.

    7 min

  33. Choose among several mutually exclusive cases

    An if/elif/else chain chooses the first matching branch and provides a fallback.

    7 min

  34. Choose a value with a conditional expression

    A conditional expression selects one value, while a short if still controls a statement.

    6 min

  35. Handle a decision inside another decision

    Nested decisions preserve separate questions, and pass supplies an intentionally empty suite.

    6 min

  36. Skip unnecessary checks with short-circuit evaluation

    Truthiness controls conditions, and and/or can stop early and return one of their operands.

    7 min

  37. Choose a case with structural pattern matching

    Match selects a case by pattern, with a wildcard for commands that do not match.

    7 min

  38. Repeat a task while a condition remains true

    A while loop retests its condition before each iteration and needs a path towards termination.

    7 min

  39. Repeat an action for each item

    For traverses an iterable, while range supplies a compact sequence of integers with an excluded stop.

    7 min

  40. Skip or stop an iteration with break and continue

    Continue skips the rest of one iteration, while break exits the nearest loop.

    7 min

  41. Run an else block when a loop finishes normally

    A loop's else suite runs when iteration ends without break, including a zero-iteration search.

    6 min

  42. Process a grid with nested loops

    An inner traversal restarts for each outer item, and break affects only its own loop.

    7 min

  43. Keep an ordered collection you can change

    A list stores ordered items that can be read, replaced and visited in sequence.

    8 min

  44. Choose a list method to add or remove items

    List methods distinguish inserting values, locating them and mutating the sequence in place.

    8 min

  45. Combine two lists in the intended order

    List combination chooses whether to create a new list, extend an existing one or delete selected bindings and items.

    7 min

  46. Sort records by a chosen value

    Sorting creates or mutates an ordered sequence, and a key function determines the compared values.

    7 min

  47. Copy a list before changing its items

    Assignment shares a list reference, while a shallow copy creates a separate outer list.

    7 min

  48. Build a filtered list with a comprehension

    A simple comprehension collects an expression for each item that passes an optional filter.

    7 min

  49. Import code from a Python module

    Import gives access to a module's named tools without copying their implementation.

    7 min

  50. Track the latest task with a list stack

    A stack returns the most recently added pending item first.

    6 min

  51. Process queued tasks in first-in first-out order

    A deque supports a queue that removes the oldest pending item first.

    6 min

  52. Keep a fixed group of related values

    A tuple keeps fixed positions whose values can be indexed and sliced without replacing its slots.

    7 min

  53. Assign tuple positions to named variables

    Unpacking names a fixed record's fields and makes a loop over records readable.

    7 min

  54. Create a changed tuple from existing values

    A revised tuple is a new sequence assembled from old values and replacement pieces.

    6 min

  55. Find a value or count repeats in a tuple

    Tuple lookups locate repeated values, while sequence comparisons inspect positions in order.

    7 min

  56. Represent rows and columns with nested lists

    Nested collections model grids and mixed records, but repeated references can accidentally share a row.

    8 min

  57. Remove duplicates with a set

    Sets retain unique hashable values and support membership without a positional order contract.

    7 min

  58. Choose a set operation for membership or comparison

    Set algebra expresses shared, missing and combined membership without counting duplicates.

    8 min

  59. Keep a set that cannot be changed

    A frozenset fixes unique membership and can itself be a member of another set.

    6 min

  60. Look up values by meaningful keys

    A dictionary maps unique hashable keys to values and preserves insertion order during ordinary iteration.

    8 min

  61. Choose a dictionary method for safe lookup or update

    Dictionary methods support optional lookups, batch changes and controlled removal of named fields.

    8 min

  62. Read a record stored inside a dictionary

    Nested dictionaries organise records by ID, and a shallow outer copy still shares inner records.

    7 min

  63. Remove repeated values while preserving order

    Order-preserving deduplication keeps the first occurrence without discarding meaningful receipt entries.

    6 min

  64. Pair related values while looping

    Enumerate and zip align related values, while any and all summarise a sequence of tests.

    8 min

  65. Package a repeated task as a function

    A function names a reusable procedure whose parameters receive values at each call.

    8 min

  66. Return a result from a function

    Return supplies a value to the caller, while printing only produces visible output.

    7 min

  67. Pass a function argument by name

    Named arguments clarify calls, while defaults supply omitted optional values.

    7 min

  68. Require an argument to be passed by name

    The / and * markers constrain how callers bind arguments to a function's parameters.

    7 min

  69. Accept a flexible set of function arguments

    Starred parameters collect extra arguments, while starred call expressions expand existing collections.

    8 min

  70. Track where a variable name can be used

    Name lookup follows enclosing scopes, while assignment normally creates or rebinds a local name.

    8 min

  71. Document a function with a docstring

    A function's first string statement records its contract for readers and help tools.

    6 min

  72. Write a small function expression for a key

    A lambda supplies a single-expression callable when a short selection rule belongs beside its use.

    6 min

  73. Solve a smaller version of a problem recursively

    Recursion reduces a problem towards a base case and returns through independent call frames.

    8 min

  74. Select a built-in function for a common task

    A focused built-in reference separates conversion, inspection, aggregation and traversal helpers.

    8 min

  75. Request values from an iterator one at a time

    An iterator remembers its next position and is exhausted after its values have been consumed.

    8 min

  76. Yield results one at a time

    A generator function pauses at yield and resumes with its local state intact when another value is requested.

    7 min

  77. Count words and analyse text

    A word-frequency table turns receipt descriptions into a small summary of recurring terms.

    8 min

  78. Recover from a failure with try and except

    A narrow try block catches expected failures with specific handlers before general ones.

    8 min

  79. Raise an exception when an input is invalid

    Validation raises a meaningful exception, and callers decide where recovery belongs.

    7 min

  80. Run cleanup code whether an operation succeeds or fails

    Finally performs required cleanup as control leaves a try statement through ordinary success or an exception.

    6 min

  81. Check a program assumption with assert

    Exception types classify failures, while assertions check internal assumptions rather than validate user input.

    8 min

  82. Open a file using the right mode

    A file mode chooses the operation, and with closes the file when its block ends.

    7 min

  83. Read text from a file

    A text file can be read as one value or traversed line by line from its current position.

    7 min

  84. Write text to a file safely

    Writing text requires deliberate replacement or append semantics and explicit line separators.

    7 min

  85. Choose a file method for reading or writing

    File methods separate content transfer, position changes and stream capabilities.

    8 min

  86. Build portable paths with pathlib

    Path objects join portable components and target specific files for inspection or deletion.

    8 min

  87. Visit files inside a directory tree

    Glob patterns find matching names, while recursive traversal visits nested directories explicitly.

    7 min

  88. Check whether two files contain the same text

    Comparing decoded text requires an explicit policy for whitespace and newline differences.

    6 min

  89. Read and write rows with the csv module

    CSV handles delimiters and quoting, while field values still require explicit type conversion.

    8 min

  90. Exchange structured data with JSON

    JSON represents portable nested data while imposing key and value restrictions beyond ordinary Python objects.

    8 min

  91. Distinguish text from mutable and immutable bytes

    Encoding bridges text and bytes, while bytearray and memoryview expose deliberate mutation of a byte buffer.

    8 min

  92. Restore a verified tracker snapshot

    A verified save-load round trip preserves the tracker records and leaves live data intact when loading fails.

    8 min

  93. Run script code only when a module is launched

    A main guard separates reusable imports from execution and exposes a script's argument list deliberately.

    8 min

  94. Report a script failure with stderr and an exit status

    Command failures use a diagnostic stream and a nonzero status, while launch mechanisms vary by operating system.

    7 min

  95. Diagnose where Python looks for imports

    Import search locations and local package structure explain where a module is found.

    7 min

  96. Organise a small script into clear files

    A small package separates calculations, storage and command handling without making imports circular.

    7 min

  97. Isolate a project's installed packages

    A virtual environment gives one project a distinct interpreter context and package installation location.

    8 min

  98. Install a package with pip

    Interpreter-qualified pip commands make package installation and inspection target the intended environment.

    7 min

  99. Find a module in the standard library

    Library documentation, help and dir support discovery but answer different questions about an interface.

    7 min

  100. Represent and format a date or time

    Date and datetime objects represent calendar values, while timedeltas represent elapsed intervals.

    7 min

  101. Calculate with the math module

    Math and cmath select different numeric domains, with complex values carrying real and imaginary components.

    8 min

  102. Generate repeatable random choices

    A seeded pseudorandom generator makes demonstrations reproducible while sampling APIs express different policies.

    6 min

  103. Summarise a data sample with statistics

    Summary measures answer different questions about a sample and require explicit empty-input and spread policies.

    7 min

  104. Find a text pattern with a regular expression

    Regular expressions recognise text patterns, while search and fullmatch answer different scope questions.

    8 min

  105. Model a real thing with an object

    A class defines a type of object that combines related state and behaviour.

    7 min

  106. Set each new object's starting state

    The initializer sets instance state, and self refers to the particular object receiving the call.

    7 min

  107. Give an object a method that uses its state

    An instance method receives its object and can calculate from or deliberately update that object's attributes.

    7 min

  108. Choose between class and instance attributes

    Class attributes provide shared lookup defaults, while instance attributes hold per-object state and can shadow class values.

    7 min

  109. Protect an object's state behind methods

    Encapsulation offers a small interface that keeps validated state changes in one place.

    7 min

  110. Extend a class with inheritance

    A subclass reuses a base contract and can specialise selected behaviour through overriding and super.

    8 min

  111. Apply one operation to different object types

    Shared behaviour lets a report call the same operation on compatible objects without branching on every type.

    7 min

  112. Choose a special method that supports an operation

    Python syntax delegates familiar operations to special methods defined on an object's type.

    8 min

  113. Wire up a persistent expense command

    A thin command layer coordinates loading, object validation, a requested action and saving.

    8 min

  114. Prove the tracker survives edge cases

    A compact regression matrix checks empty data, Unicode, duplicate-looking receipts and storage failures.

    8 min

  115. Demonstrate a complete expense workflow

    The final challenge combines command handling, persistent records and an object-based report into one explainable workflow.

    8 min

  116. Certificate

    Finish the last module to earn it.

Your certificate

Finish the course for a certificate with your name and a unique credential ID. Anyone can check it from its public link, and you can download it or add it to LinkedIn.

Certificate of completion

This certifies that

Your name

has completed the course

Python A2Z: Foundations

by passing every checkpoint and completing the required work in the course on Lab0.

Issued
Date of completion
Credential ID
Unique to each certificate
Verify
lab0.viovn.com/certificates

Issued by Lab0, a product of Viovn Edutech Private Limited

Questions

Is the whole course free?

Yes. Every lesson, lab and checkpoint in this course is free with a Lab0 account.

Do I need to install anything?

No. Lessons, practice and checkpoints all run in your browser, on any device.

Can I skip parts I already know?

Yes. You can attempt a level checkpoint straight away. Pass it and the next level unlocks.

Start the first lesson now, free.