FLOWLYTIX AI BOOTCAMP SERIES · PART 1 OF 2

Python Fundamentals: From Zero to Your First Programs

Variables, data types, strings, control flow, loops, core data structures, and functions — with a real, runnable Python editor built into every module.

6
Modules
20+
Code Snippets
0
Prereqs Needed
Live Code Runs
python3 — hello.py
Course Map

Six modules — from a blank editor to writing your own functions

⏳ Loading the Python interpreter — one-time, ~10-15s...

Every module below includes a real, editable Python editor — powered by Pyodide, running entirely in your browser.

Module 1 · Getting Started

1Getting Started with Python

Setting up your environment and running your very first line of code.

What Is Python, and Why Learn It?

Python is a high-level, general-purpose programming language known for readable syntax that reads almost like plain English.

📖 Readable

Clean syntax with minimal punctuation — code that's easy to write and re-read later.

🧩 Versatile

Used for web apps, data science, AI/ML, automation, scripting, and more.

🌱 Beginner-Friendly

A gentle learning curve, with one of the largest communities for support.

📈 In-Demand

Consistently ranked among the most requested skills in tech job listings.

USED BY Google, Netflix, Instagram, NASA, and most AI/ML research labs all rely heavily on Python for production systems and research alike.

Installing Python & Choosing an Editor

Two decisions before you write a single line.

1. INSTALL PYTHON
  • Download the latest version from python.org/downloads
  • On Windows, check "Add Python to PATH" during install
  • macOS and Linux often ship with Python — verify the version
  • Confirm it worked by checking the version in a terminal
$ python --version
Python 3.12.4
2. PICK AN EDITOR
VS Code Free, lightweight, huge extensions — great default
PyCharm Full IDE, deep debugging, popular for larger projects
Jupyter Notebook Cell-based, inline output — ideal for experimentation

This course uses VS Code in examples, but any of these will work fine.

Your First Program: Hello World

Every language tradition starts here — let's run it two different ways.

METHOD 1 — RUN A .PY FILE

# hello.py
print("Hello, World!")

Save code in a .py file, then run it from the terminal with the python command.

METHOD 2 — INTERACTIVE SHELL (REPL)

$ python
>>> print("Hello, World!")
Hello, World!
>>> 1 + 1
2

The REPL ("Read-Eval-Print Loop") runs one line at a time — perfect for quick tests.

▶️ Try It Yourself — Live Python Editor

Comments & Code Style

Code is read far more often than it's written — style matters from day one.

PEP 8 — PYTHON'S STYLE GUIDE Use 4 spaces per indentation level (not tabs) · lowercase_with_underscores for names · ALL_CAPS for constants · keep lines under ~79-99 characters · blank line between logical sections.
WHY INDENTATION MATTERS Unlike many languages, Python uses indentation itself to define code blocks — there are no curly braces { }. Inconsistent indentation causes real errors, not just messy formatting.
Module 2 · Variables & Types

2Variables & Data Types

How Python stores, labels, and converts the values your programs work with.

Variables & Assignment

A variable is a name that points to a value stored in memory.

name = "Ada"
age = 28
height_m = 1.68
is_student = False
# Multiple assignment in one line
x, y, z = 1, 2, 3

NAMING RULES Must start with a letter or underscore (not a digit) · letters/digits/underscores only · case-sensitive (ageAge) · can't use reserved keywords like if, for, or class.
DYNAMICALLY TYPED You don't declare a type up front — the variable's type is inferred from the value, and can change if you reassign it to a value of a different type.

Core Data Types

Five building-block types you'll use in nearly every program.

Type Example Meaning
int 42 Whole numbers, positive or negative
float 3.14 Numbers with a decimal point
str "hi" Text, wrapped in quotes
bool True Exactly one of True or False
NoneType None Represents "no value"

type(42) → <class 'int'>  ·  int("5") → 5  ·  str(5) → "5"  ·  float(5) → 5.0

🧩 Puzzle: Sort Each Value by Its Type

Select a value, then click the type it belongs to.

Strings, In Depth

SLICING & INDEXING

word = "Python"
word[0] # 'P'
word[-1] # 'n'
word[0:3] # 'Pyt'
len(word) # 6

USEFUL METHODS

"Hi".upper() # 'HI'
" hi ".strip() # 'hi'
"a,b".split(",") # ['a','b']
"-".join(["a","b"]) # 'a-b'

F-STRINGS — THE MODERN WAY TO FORMAT TEXT name = "Ada"; age = 28
print(f"{name} is {age} years old") # Ada is 28 years old

Basic Input & Output

name = input("What is your name? ")
print(f"Hi, {name}!")

IMPORTANT: input() ALWAYS RETURNS TEXT Even if the user types a number, input() gives you back a string. Convert it before doing math: age = int(input("Age: ")).

▶️ Try It Yourself — Live Python Editor

Module 3 · Control Flow

3Operators & Control Flow

Comparing values and teaching your programs to make decisions.

Operators

Category Operators Meaning
Arithmetic + - * / add, subtract, multiply, divide
// % ** floor divide, modulo, exponent
Comparison == != equal to, not equal to
< > <= >= less/greater than (or equal)
Logical and true if BOTH sides are true
or / not true if EITHER side is true / negation

7 // 2 → 3  ·  7 % 2 → 1  ·  2 ** 5 → 32  ·  5 > 3 and 2 < 4 → True

Conditional Statements: if / elif / else

temperature = 28
if temperature > 30:
    print("It's hot!")
elif temperature > 20:
    print("Nice weather.")
else:
    print("Bring a jacket.")
# Output: Nice weather.

if

Checked first. If True, its block runs and the rest is skipped.

elif

Checked only if the above was False. You can chain as many as needed.

else

Runs only if every condition above was False. Always optional.

ONE BRANCH ONLYOnly one branch ever runs, even if multiple conditions would technically be true.

Truthy & Falsy Values

Every value in Python can be evaluated as True or False in a condition — even non-boolean ones.

🧩 Puzzle: Truthy or Falsy?

Select a value, then click Truthy or Falsy.

Nested Conditionals

if age >= 18:
    if has_ticket:
        print("Welcome in!")
    else:
        print("Please buy a ticket.")
else:
    print("Must be 18 or older.")

A CLEANER ALTERNATIVE if age >= 18 and has_ticket: print("Welcome in!") — reach for and/or when conditions are related; keep nesting for genuinely separate decision steps.

▶️ Try It Yourself — Live Python Editor

Module 4 · Loops

4Loops & Iteration

Teaching your programs to repeat work without repeating code.

For Loops & range()

A for loop runs its block once for every item in a sequence.

fruits = ["apple", "banana", "kiwi"]
for fruit in fruits:
    print(fruit)
# apple / banana / kiwi

for i in range(5): print(i) → 0 1 2 3 4  ·  range(2, 10, 2) → 2 4 6 8 (stop is never included)

HANDYenumerate(fruits) gives you both the index and the item together — great when you need to know "which position" you're on.

While Loops

Repeats as long as a condition stays true — used when you don't know the count in advance.

count = 0
while count < 3:
    print(f"Count is {count}")
    count += 1 # don't forget this!

WATCH FOR INFINITE LOOPS If the condition never becomes False, the loop runs forever. Always make sure something inside the loop moves it toward ending. Use a for loop when you know how many times to repeat; use a while loop when repetition depends on a condition.

break, continue & else on Loops

break

Immediately exits the loop entirely, skipping anything left.

continue

Skips just this one iteration and moves to the next.

else

Runs only if the loop finished WITHOUT hitting break.

PYTHON'S LOOP ELSE IS UNIQUE It's a clean way to ask "did this search complete without finding what I was looking for?" without a separate flag variable.

Puzzle: Trace a Nested Loop

A loop inside a loop — put these execution events back in the order they actually happen for for row in range(1,3): for col in range(1,3): print(row,col).

▶️ Try It Yourself — Live Python Editor

Module 5 · Data Structures

5Core Data Structures

Lists, dictionaries, tuples, and sets — Python's built-in ways to organize data.

LISTS — ORDERED, CHANGEABLE

fruits = ["apple","banana"]
fruits.append("mango")
fruits[1] = "pear"
fruits.remove("apple")

Ordered, mutable, allows duplicates & mixed types, indexed from 0.

DICTIONARIES — KEY : VALUE

person = {"name":"Ada","age":28}
person["age"] = 29
person["city"] = "Lagos"

Keys unique & immutable, mutable values, insertion order preserved since Python 3.7.

TUPLES — ORDERED & IMMUTABLE

point = (4, 7)
x, y = point
point[0] = 9 # TypeError!

Once created, contents can never change. Use for fixed data like coordinates.

SETS — UNIQUE & UNORDERED

nums = {1, 2, 2, 3} # {1,2,3}
a = {1,2}; b = {2,3}
a | b # union
a & b # intersect

Automatically drops duplicates. Great for membership checks and comparisons.

Choosing the Right Data Structure

Structure Syntax Ordered Mutable Duplicates Good For
List [ ] Yes Yes Yes A shopping list, a queue of tasks
Tuple ( ) Yes No Yes A coordinate pair, RGB color values
Dictionary {k: v} Yes* Yes By key A user profile, a lookup table
Set { } No Yes No Unique tags, fast membership checks

* Dictionaries preserve insertion order (since Python 3.7), but are accessed by key, not position.

🧩 Puzzle: Which Structure Fits Best?

Select a scenario, then click the data structure that fits it best.

▶️ Try It Yourself — Live Python Editor

Module 6 · Functions

6Functions Basics

Packaging code into reusable, nameable blocks.

Defining Functions

def greet(name):
    """Return a greeting for name."""
    return f"Hello, {name}!"
message = greet("Ada")
print(message) # Hello, Ada!

def

Keyword that starts a function definition.

greet(name)

The function's name and its parameter(s).

return

Sends a value back to wherever it was called.

PARAMETER VS. ARGUMENT A parameter (like name) is a placeholder defined in the function. An argument (like "Ada") is the actual value you pass in when calling it. Functions without a return statement automatically give back None.

Default & Keyword Arguments

DEFAULT ARGUMENTS

def greet(name, greeting="Hi"):
    return f"{greeting}, {name}!"
greet("Ada") # Hi, Ada!
greet("Ada", "Yo") # Yo, Ada!

KEYWORD ARGUMENTS

def describe(name, age, city):
    return f"{name}, {age}, {city}"
describe(city="Lagos", name="Ada", age=28)

RULEParameters with defaults must come after parameters without defaults in the function definition.

Scope, and *args / **kwargs

x = 10 # global scope
def show():
    y = 5 # local scope
    print(x, y) # 10 5
show()
print(y) # NameError!

def total(*args): return sum(args)  ·  total(1,2,3) → 6  ·  def info(**kwargs): print(kwargs)

🧩 Puzzle: Label the Parts of a Function Call

Given def greet(name, greeting="Hi"): return f"{greeting}, {name}!" — sort each term below.

▶️ Try It Yourself — Live Python Editor

Course Recap — Part 1

  • Installed Python, chose an editor, and ran your first Hello World program
  • Stored data in variables using Python's core types: int, float, str, bool, None
  • Formatted and manipulated text with string slicing, methods, and f-strings
  • Made decisions with if / elif / else, and understood truthy vs falsy values
  • Repeated work with for and while loops, using break, continue, and else
  • Organized data with lists, dictionaries, tuples, and sets
  • Wrote your own reusable functions with parameters, defaults, and *args/**kwargs
COMING IN PART 2 Object-oriented programming (classes & objects), file handling, exception handling, modules & imports, and list/dict comprehensions.
Quick Revision

Master Cheat Sheet

Every core reference table from the course, in one place.

Core Types

int 42
float 3.14
str "hi"
bool True / False
NoneType None

Operators

// % ** floor div, modulo, power
== != < > comparisons
and / or / not logical

Data Structure Syntax

List [1, 2, 3]
Tuple (1, 2, 3)
Dict {"k": "v"}
Set {1, 2, 3}

Function Anatomy

def name(param="default"):
    return value

A–Z Reference

Glossary — Flip to Reveal

Click any card to flip it and see the definition.

Final Assessment

Final Comprehensive Assessment

15 mixed questions spanning all six modules. Your live score is tracked at the top.