Online Python Compiler
Write, run and test Python code online, right in your browser. This free online Python compiler needs no installation or signup — just type your code and click Run.
Python is a beginner-friendly, general-purpose language used for scripting, automation, data analysis, web development and machine learning.
How to use the Python compiler
- Write or paste your Python code in the editor.
- If your program reads input, open the I/O tab and type it into the STDIN box (one value per line).
- Click Run — the output and any errors appear in the output panel.
Sample: read input in Python
name = input()
print(f"Hello, {name}!")
Paste this into the editor, type your name in the STDIN box and click Run.
More Python examples to try
Sum of numbers from input
Reads space-separated numbers from STDIN (for example 4 8 15) and prints their total and average.
nums = list(map(int, input().split()))
print("Total:", sum(nums))
print("Average:", sum(nums) / len(nums))
Functions and loops
A function that checks for prime numbers, used in a loop to list primes up to 30.
def is_prime(n):
if n < 2:
return False
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return True
print([n for n in range(31) if is_prime(n)])
Common Python errors and how to fix them
IndentationError: expected an indented block- Python uses indentation instead of braces. Indent the lines inside
if,for,defandclassblocks consistently (4 spaces is standard). EOFError: EOF when reading a line- Your program called
input()but no input was given. Type the values in the STDIN box under the I/O tab before clicking Run, one per line. TypeError: can only concatenate str (not "int") to strinput()always returns text. Convert it first, e.g.int(input()), or format output with an f-string:f"Age: {age}".NameError: name 'x' is not defined- The variable or function is used before it is created, or its name is misspelled. Python names are case-sensitive.
Frequently asked questions
Is this online Python compiler free?
Yes. It is completely free to use, with no signup required to write and run code.
Do I need to install anything?
No. It all works from your web browser, so there is nothing to download or set up — it works on Windows, macOS, Linux, Chromebooks and phones.
How do I give input to my Python program?
Before clicking Run, type the input into the STDIN box under the I/O tab, one value per line. Your program reads it as standard input, just like typing in a terminal.
Is this good for learning Python?
Yes. It is ideal for practising exercises, testing small programs and trying out ideas from tutorials, because you can run code instantly without configuring an environment.
Other online compilers
Java Compiler C Compiler C++ Compiler C# Compiler JavaScript Compiler TypeScript Compiler SQL Compiler React.js Compiler HTML Compiler Go Compiler Rust Compiler R Compiler PHP Compiler Kotlin Compiler Swift Compiler Scala Compiler Dart Compiler Ruby Compiler Prolog Compiler Perl Compiler
Editor powered by OneCompiler.