Python Basics: Interactive Python Lessons
Start from zero: variables, data types, input and output, and your very first print statement. These interactive Python basics exercises give you instant feedback as you write real code in the browser.
54 lessons in this topic — 9 free to start. Every lesson runs real Python in your browser with instant feedback.
Hello Python World
Learn to print your first message in Python
Variables and Numbers
Store and use numbers in variables
Simple Math Operations in Python
Learn how to perform basic math operations using Python.
String Fun
Work with text in Python
Print Multiple Lines
Learn to print multiple messages
Numbers and Math
Work with different numbers
Subtraction Fun
Practice subtraction in Python
Multiplication Magic
Multiply numbers together
Division Basics
Divide numbers in Python
Comments in Code
Add comments to explain code
Variable Names
Learn good variable naming
Number Comparison
Compare numbers with operators
Boolean Values
Work with True and False
Multiple Variables
Create several variables at once
Modulo Operator
Find remainders with modulo
Power Operator
Learn how to use the power operator (**) to calculate exponents in Python.
Integer Division
Divide without decimals
Greet Ada
Print exactly: Hi Ada, welcome to Python!
Negative Indexing
Access items from the end
Type Conversion - String to Int
Convert text to numbers
Type Conversion - Int to String
Convert numbers to text
Is 14 even or odd?
Print 'even' if 14 is even, else 'odd'.
Absolute Value
Get positive version of numbers
Round Function
Round decimal numbers
Logical AND
Combine conditions with AND
Is 14 greater than 3?
Print whether 14 > 3 (True or False).
Logical OR
Combine conditions with OR
Logical NOT
Invert boolean values
In Operator
Check if item exists
Using the "not in" Operator
Check if an item does not exist in a list or string using the "not in" operator.
Identity Operator
Check if variables are same object
Add 3 to the text "14"
14 is a string. Convert it to a number, add 3, print the result.
Remainder of 14 ÷ 3
Print the remainder of 14 divided by 3 using %.
Greet Sam
Print exactly: Hi Sam, welcome to coding!
Is 7 even or odd?
Print 'even' if 7 is even, else 'odd'.
Is 7 greater than 5?
Print whether 7 > 5 (True or False).
Add 5 to the text "7"
7 is a string. Convert it to a number, add 5, print the result.
Remainder of 7 ÷ 5
Print the remainder of 7 divided by 5 using %.
Greet Mia
Print exactly: Hi Mia, welcome to Python!
Is 40 even or odd?
Print 'even' if 40 is even, else 'odd'.
Is 40 greater than 6?
Print whether 40 > 6 (True or False).
Add 6 to the text "40"
40 is a string. Convert it to a number, add 6, print the result.
Remainder of 40 ÷ 6
Print the remainder of 40 divided by 6 using %.
Greet Leo
Print exactly: Hi Leo, welcome to programming!
Is 42 even or odd?
Print 'even' if 42 is even, else 'odd'.
Is 42 greater than 8?
Print whether 42 > 8 (True or False).
Add 8 to the text "42"
42 is a string. Convert it to a number, add 8, print the result.
Remainder of 42 ÷ 8
Print the remainder of 42 divided by 8 using %.
Greet Noa
Print exactly: Hi Noa, welcome to Python!
Is 100 even or odd?
Print 'even' if 100 is even, else 'odd'.
Is 100 greater than 7?
Print whether 100 > 7 (True or False).
Add 7 to the text "100"
100 is a string. Convert it to a number, add 7, print the result.
Remainder of 100 ÷ 7
Print the remainder of 100 divided by 7 using %.
Greet Eli
Print exactly: Hi Eli, welcome to coding!