Python is a general-purpose programming language known for readable syntax and a large standard library. It is used for web development, data analysis, automation, scientific computing, machine learning, and teaching.
This tutorial assumes no programming experience. You will write a short program, run it, and learn how the parts of the page fit together.
What makes Python different?#
Python uses indentation to show blocks of code, and its syntax is designed to be close to plain English. A complete program can be a single line:
print("Hello, World!")The line calls the built-in print() function. The text inside the quotes is a string, a value that stores characters. Running the program writes the text to standard output.
How the browser compiler works#
ILoveCompiler runs CPython compiled to WebAssembly inside a dedicated Web Worker. The first visit downloads the runtime, which can take a few seconds. After that, runs are fast and local.
- Write Python in the editor.
- Press Run (or
Ctrl/Cmd+Enter). - Read the result in the Output panel.
- Use the Errors panel to inspect tracebacks.
Your code is not uploaded to a server for execution. Drafts are stored in your browser's local storage.
Your turn#
Replace the code in the editor with this program and run it:
name = "ILoveCompiler"
print("Hello from", name)
print("Python is running in my browser.")Hello from ILoveCompiler Python is running in my browser.
If you see an error, check for missing quotes or parentheses. Python reports the line where it noticed the problem in the Errors panel.
Key ideas to remember#
- Python programs are made of statements, usually one per line.
- Strings are written inside single or double quotes.
print()displays values.- Indentation matters when you start using blocks such as
ifandfor.
Next, learn how print() works in more detail and how to leave notes with comments.
