Skip to content
Hands-on Mentor
ENTR
Back to blog

How to run Python in your browser with no install

Run Python in your browser with no install. It works on a school laptop or a phone. Here is how it works and a first program you can try right now.

4 min read

You can run Python in your browser with no install. Python itself runs inside the page, so you type code, press run, and see the output. There is no download, no setup, and no administrator password. It works on a school computer or a phone browser.

The Python course on Hands-on Mentor is built this way. It is free, and your code runs on your own device.

Why is installing Python a problem for some students?

On a personal laptop, installing Python is usually fine. For many students it is not that simple:

  • School and library computers often block installing software.
  • A phone or tablet cannot run the usual installer.
  • Different versions and tools can conflict with each other.
  • Beginners meet setup errors before they write a single line of code.

When setup is the first lesson, many people stop before they start. Running code in the browser removes that step.

How does Python run inside a browser?

A browser can run a full copy of Python that was built to work inside a web page. When you open an exercise, the page loads Python into your tab. When you press run, your code is executed by that copy, on your device. Nothing is executed on a server.

The first run can take a few seconds while Python loads. After that, short programs finish quickly.

What can you do with browser Python?

You can write the same Python you would write anywhere: variables, conditions, loops, functions, lists, dictionaries, files, and more. The course uses one case, a small shop called Corner Café in the fictional city of Port Alder, so every exercise builds on the same menu and orders.

Try this program. It adds up an order of four drinks and snacks:

menu = {"latte": 4.25, "tea": 1.25, "cookie": 2.00}
order = ["latte", "tea", "cookie", "latte"]
total = sum(menu[item] for item in order)
print(f"Total: ${total:.2f}")
OutputTotal: $11.75

The two latte orders cost $8.50, plus $1.25 for tea and $2.00 for a cookie, which gives $11.75. Now print the whole menu with a loop:

for item, price in menu.items():
    print(f"{item}: ${price:.2f}")
Outputlatte: $4.25
tea: $1.25
cookie: $2.00

Change a price, add an item to the order, and run it again. Small experiments teach more than reading.

Because everything stays in the tab, you can also practice on the bus, in a library, or between classes, as long as you have a browser.

What can browser Python not do?

Be clear about the limits. Code in a browser tab is not the right place to run a program that must stay on all day, such as a bot or a web server. It also cannot freely read files from your computer or install any package you find online. A set of data tools is available for the course exercises.

For learning how to program, none of this matters. Variables, loops, and functions work the same everywhere. When you later move to your own machine, your skills transfer.

What should your first session look like?

Keep it small and finish something in 15 minutes:

1. Run the order example above without changing it.

2. Change the order list and predict the total before you run it.

3. Add a new item to menu and use it in the order.

4. Break the code on purpose, for example by removing a quote, and read the error message.

Each step takes a minute or two. Do not worry if you get an error. Python errors are short messages that tell you the line and the kind of problem, and fixing them is part of learning. Reading an error message you caused yourself is the best way to stop fearing errors.

How do you start?

1. Open the [Python course page](/courses/python). Lesson text is open to read.

2. Sign up for free to do the exercises, tests, and projects.

3. Start with [your first program](/learn/python/first-program).

4. Pass each short test with 70% to unlock the next lesson.

You only need a current browser and an internet connection.

What to read next

  • [Python course: 40 short lessons, free](/courses/python)
  • [First program lesson](/learn/python/first-program)
  • [Python for loop explained](/blog/python-for-loop)
  • [Common Python errors and what they mean](/blog/common-python-errors)
  • #python
  • #run python in browser
  • #no install
  • #beginners
All posts