Python Playground

Write real Python 3 and run it straight away — no installation, no login, no Wi‑Fi needed after the first run. print(), input(), loops, lists, files and even charts all work.

Class 9–12 · CBSE CS & IP Real Python 3.12 48 example programs Runs on your device

You can run Python in a browser with nothing to install: this page loads a real Python 3.12 interpreter and runs your program on your own device. Type print("Hello"), press Run, and the output appears beside the code. input(), loops, lists, file handling and matplotlib charts all work, and 48 example programs are ready to load.

Nothing you type is uploaded. Python itself is downloaded once from a public code library and then runs completely inside this browser tab, on your own phone or computer. Your programs, your typing and the files your code creates never leave your device and are never sent to any server.

program.py

Python not started yet
Program input — answers for input(), one per line
Whatever you type into an on-screen prompt is added here, so you can run the same program again without retyping.

Output

ready
Files your program creates with open() will appear here.

Python program


        

Output


      

Example programs

48 ready programs covering the whole CBSE Python course. Click one to load it, then change it and run it again.

My saved programs

Saved on this device only (browser storage) — useful for homework you want to finish later.

Ctrl+Enter Run Tab Indent 4 spaces Shift+Tab Remove indent Ctrl+/ Comment a line Ctrl+S Save program
How it works

A full Python lab inside one browser tab

Schools often cannot install software on every computer, and phones cannot run Python at all. This page downloads a real Python 3.12 interpreter once and then runs your programs on the device itself — so practicals work even on a shared lab PC or a parent's phone.

Pick or type a program

Load one of the 48 examples, or start typing your own in the editor.

Press Run

The first run downloads Python (a few seconds). Every run after that is instant.

Answer any prompts

When your program reaches input(), a box appears below the output. Type and press Enter.

Read the output or the error

Errors show the exact line number, so you can fix them like a real programmer.

The four things every program uses

print("Hello") shows something on the screen.

x = input("Name: ") waits for the user and always gives a string.

n = int(x) converts that string to a number — forget this and "5" + "3" becomes "53".

# starts a comment that Python ignores.

Indentation is Python's grammar

Other languages use { }. Python uses spaces, so the blank space at the start of a line decides what belongs inside an if, a loop or a function.

Use 4 spaces for every level and never mix tabs with spaces — press Tab in this editor and it types 4 spaces for you. Press Enter after a line ending in : and it indents automatically.

Errors you will meet (and what they mean)

SyntaxErrorA full stop missing from the grammar — often a forgotten : or bracket.
IndentationErrorSpaces at the start of a line do not line up.
NameErrorA variable or function name was used before it was created (check the spelling).
TypeErrorMixing types, like adding a number to a string.
ValueErrorRight type, impossible value — int("abc").
IndexErrorAsking for item 5 of a list that has only 3 items.
KeyErrorThat key is not in the dictionary.
ZeroDivisionErrorSomething was divided by 0.

What the examples cover

Class 9–10 (IT 402 / Computer): print, variables, operators, if, loops, patterns, lists, strings.

Class 11 Computer Science (Unit 2): data types, operators, flow of control, lists, tuples, dictionaries, strings, functions, and an introduction to files.

Class 12 / Informatics Practices: user-defined functions, recursion, text-file handling, exception handling and simple data charts with matplotlib.

Practical exam tip. Type the program yourself instead of copying it — the marks in a CBSE practical come from the output, the variable names and your explanation. Use Save to keep your 20 practical-file programs on this device, and .py to download one for your record file.
Questions & answers

Python Playground — your questions

Can I run Python online without installing anything?

Yes. This page downloads a real Python 3.12 interpreter the first time you press Run, then runs everything inside the browser tab on your own phone or computer. Nothing you type is uploaded to a server. It works on a shared school lab PC where software cannot be installed, and on a parent's phone.

Does input() work in this online Python compiler?

Yes. When your program reaches input(), the running program pauses and an input box appears below the output. Type your answer and press Enter, and the program carries on. Your answers are kept in a Program input box, so you can run the same program again without retyping them.

Why does 5 + 3 give 53 in my Python program?

Because input() always returns a string, never a number. "5" + "3" joins the two pieces of text into "53". Wrap it in int() to convert first: n = int(input("Enter a number: ")). Use float() instead when the answer can have decimals. This is the single most common mistake in Class 11 practicals.

Why does Python show an IndentationError?

Python uses spaces instead of curly brackets, so the blank space at the start of a line decides what sits inside an if, a loop or a function. An IndentationError means the spaces do not line up. Use 4 spaces for every level and never mix tabs with spaces — pressing Tab in this editor types 4 spaces for you.

Can I draw graphs with matplotlib here?

Yes. import matplotlib.pyplot as plt works, and plt.show() draws the chart straight into the output panel as a picture. That covers the simple data-visualisation questions in the Class 12 Informatics Practices syllabus. File handling with open() works too, and any files your program creates are listed below the output.

Which topics do the 48 example programs cover?

Class 9–10 work on print, variables, operators, if statements, loops, patterns, lists and strings; the Class 11 Computer Science Unit 2 topics of data types, flow of control, lists, tuples, dictionaries, strings and functions; and Class 12 and IP topics including user-defined functions, recursion, text files, exception handling and simple charts.

Is my program saved if I close the tab?

Only if you press Save. Saved programs are stored in your own browser's storage on that one device, so they survive closing the tab but will not appear on another computer. Use the .py button to download a copy you can keep, email to yourself or paste into a practical record file.