Python Variables
Create variables and display their values using Python.
Strengthen your Python skills with practical exercises, coding challenges, hints and solutions.
def calculate_total(price, quantity):
total = price * quantity
return total
price = 1500
quantity = 3
print(
calculate_total(price, quantity)
)
Start where you are and improve step by step.
Create variables and display their values using Python.
Work with integers, floats, strings and Python data types.
Solve calculations using Python arithmetic and operators.
Manipulate text using Python string operations and methods.
Create lists, access elements and work with indexes.
Store and retrieve information using Python dictionaries.
Make decisions using if, elif and else statements.
Practice repeating tasks using for and while loops.
Build reusable Python functions with parameters and return values.
Read and write files using Python's file handling tools.
More practice challenges are coming soon.
Turn what you learn in lessons into practical Python skills.
Study the concept in the PyLearn lessons.
Solve coding exercises based on what you learned.
Test yourself with increasingly difficult problems.
Track your progress and strengthen your skills.
Type Python code, run it directly in your browser, and see the output without installing Python.
Click “Run Python” to execute your code.
Choose an exercise and start coding.