Understand your
first Python program.
A short audio introduction. Then try the idea in code.
name = "Ada"print(name)AdaYour turn, Ada.
A variable gives a value a name. Here, name refers to a piece of text. print(name) shows that text.
Change the name and follow it through both lines.
name = "Ada"
print(name)
An interactive illustration of these two lines, not a Python interpreter. Your entry stays in this page.
Your goal: Introduce Python basics including variables, data types, and control flow to enable learners to write simple programs.
Follow the idea
Follow the program, one idea at a time.
01 / 03
Give a value a name.
name = "Ada" binds the name name to a string. The quotes mark text; they are not part of the stored value. Later lines can use that name instead of repeating the text.
02 / 03
Ask a question before taking a branch.
== compares two values. Here the name is Ada, so the indented line runs and builds "Hello, Ada". A single = assigns; two compare.
03 / 03
Repeat the work, not the instructions.
range(2) gives the loop two turns. Each turn prints the greeting, so the output has two lines. The indentation tells Python which instruction belongs inside the loop.
A path through the topic
A suggested syllabus for the course you can create in Nemonic.
Python Variables and Data Types
Understand how to assign values to variables and recognize basic data types like integers, floats, and strings.
Using Python as a Calculator
Perform arithmetic operations and understand operator precedence and different division types.
Working with Strings
Manipulate text using strings, including indexing, slicing, and concatenation.
Control Flow with if Statements
Write conditional statements to execute code based on different conditions.
Loops: for and while
Use for and while loops to repeat actions, including iterating over sequences and using break and continue.
Read the sample
Original Nemonic sample · AI-generated narration · 59 seconds
Imagine you're organizing a bookshelf. Each book has a label — just like variables in Python hold values. You can assign a number or text to a variable, for example, width = 20 or name = 'Alice'. Python can also act like a calculator: typing 2 + 2 returns 4. It understands different types of numbers, like whole numbers and decimals, and can perform operations like division or powers. Now, think of control flow as decision-making in your daily routine. An if statement checks a condition, like 'if it’s raining, take an umbrella'. Similarly, Python runs code only if certain conditions are met. Loops help repeat tasks, like checking each book on your shelf one by one. A for loop can go through a list of words, printing each with its length. These tools let you write programs that think and act step-by-step, just like you do.
Try it yourself
Imagine a program that starts with x equal to three. First, it checks whether x is greater than five. If that is false, it checks whether x equals three. If neither condition matches, it uses a final fallback message. Which branch runs, and why? The second branch runs: three is not greater than five, but it does equal three. Once that matching branch runs, Python skips the fallback. Try changing x to seven and tracing the decisions again.
Sources & further learning
Written for Nemonic with AI assistance and automated source checks. Sources inform the lesson; their publishers do not endorse Nemonic. Updated 2026-09-24.
Keep exploring
Make it your own