Basic LevelCORE BASICS · Python TrackCompiler: python3 (CPython 3.12)
Python Basic Syntax & Control Flow
Variables, f-strings, arithmetic, conditionals, and loop iterations.
Exercises:5 Practice Labs
All Python ModulesBasic Coding Labs (5)Click any card to start in laboratory
Lab #01 · Basic Syntax
Easy5 mins
01. Print Output, Variables & Format Specifiers
Learn how to output text, assign variables, and use f-strings.
Objective: Define variables for `language = 'Python'` and `version = 3.12`. Print: `[*] Learning Python version 3.12 at BytesLab!`.
Interactive SandboxStart Lab
Lab #02 · Variables & Types
Easy6 mins
02. Data Types, Arithmetic & Modulo Operations
Perform arithmetic calculations, type casting, and modulo operations.
Objective: Given integers `a = 29` and `b = 4`, calculate and print integer quotient `a // b` and remainder `a % b` formatted as `29 = 4 * 7 + 1`.
Interactive SandboxStart Lab
Lab #03 · Control Flow
Easy8 mins
03. Conditionals & If-Elif-Else Branching
Control execution flow using `if`, `elif`, and `else` conditions.
Objective: Write a function `check_port_security(port: int) -> str` that returns 'HTTPS (Secure)' for 443, 'HTTP (Insecure)' for 80, 'SSH' for 22, and 'Unknown Port' otherwise.
Interactive SandboxStart Lab
Lab #04 · Loops & Iteration
Easy10 mins
04. For & While Loops (Iteration & Ranges)
Iterate through sequences using `for num in range()` and accumulator loops.
Objective: Write a function `sum_even_numbers(n: int) -> int` that calculates the sum of all even numbers from 1 to `n` inclusive using a loop.
Interactive SandboxStart Lab
Lab #05 · Nested Loops
Easy10 mins
05. Nested Loops & Pattern Printing
Generate structured coordinate grids and triangular matrices with nested loops.
Objective: Write a function `print_triangle(rows: int)` that prints a right-angled triangle of asterisks (`*`) of height `rows`.
Interactive SandboxStart Lab