Online Python Compiler
Write Python 3, press Run, and see the result. Nothing to install.
About this Python compiler
This free online Python compiler runs your code with Python 3.12 on our server. When your code calls input(), type the answer in the terminal and press Enter. You see the printed output, and if there is an error, you see the full error message with its line number.
It is made for beginners who want to try Python without installing anything, and for anyone who wants to test a small piece of code quickly.
How to use it
- Type your Python code in the editor.
- When your code calls input(), type the answer in the terminal below the editor and press Enter.
- Press Run. The output appears below.
Python examples
Open any of these from the Examples tab in the side bar.
Hello, World
print("Hello, World!")
Read input and add
a = int(input())
b = int(input())
print(f"{a} + {b} = {a + b}")
Count letters with a dictionary
text = "programming"
counts = {}
for ch in text:
counts[ch] = counts.get(ch, 0) + 1
for ch, n in sorted(counts.items()):
print(ch, n)
What is Python?
Python is the most popular first language today. The code reads almost like English, so you can focus on the logic instead of the symbols. It is used for data science, machine learning, web servers and automation scripts.
Python is an interpreted language: there is no separate compile step that you need to run. If something is wrong, Python stops at that line and prints a "traceback" that shows where the error happened.
Common errors and how to fix them
IndentationError: expected an indented blockThe lines inside if, for, while and def must start with spaces. Use 4 spaces.NameError: name 'x' is not definedThe name is spelled wrong, or you used the variable before you created it.ValueError: invalid literal for int() with base 10: ''int(input()) read an empty line: you pressed Enter without typing a number, or the Input box has a blank line. Type a number, then press Enter.TypeError: can only concatenate str (not "int") to strinput() always gives text. Use int(input()) to read a number, and str(n) or an f-string to print a number next to text.
Frequently asked questions
Which Python version is used?
Python 3.12. The f-strings, match statements and type hints all work.
Can I use input()?
Yes. When your program asks, type the answer in the terminal and press Enter. You can also put the answers in the Input box before you press Run; each input() call reads one line.
Can I use packages such as numpy or pandas?
Yes. numpy and pandas are installed, and so is the whole standard library (math, random, collections, itertools and more). You cannot install other packages, because programs have no internet access.
Is there a time limit?
Yes. Without an account each run can use 3 seconds of computer time (5 seconds with a free account). A program that is waiting for your input can wait up to 30 seconds.
Is this the same as an IDE?
It is a quick place to run code. For bigger projects with many files, use an editor such as VS Code on your computer.
Other free compilers
Learn to code with DevHives
Step-by-step lessons, DSA problems with a judge and mock interviews — made for students in India.
Create a free account