Repl.it

Imagine you are sitting at the computer and staring at some weird screen that doesn't look like anything you've seen before. Some sort of alien app for communication, maybe a messenger? You see two panels: one bright and one dark. For you, this kind of messenger doesn't look powerful, especially since the visual interface doesn't contain a lot of elements you can intuitively understand. You notice a small button that says "RUN". "This seems dangerous…" you tell yourself.

Okay, you may be thinking "what the hell, what does that have to do with Python programming?!" The answer is — a lot. Click here to open REPL.it, your personal app which allows you to interact with the Python interpreter.

That whole interface, including the white panel, the dark panel and the ("RUN") button, is an intermediary app. The interpreter itself is actually running on a remote server. By using this browser-based app, you don’t need to install anything on your computer. REPL.it vs. installed interpreter is like Google Docs vs. Microsoft Word. Word needs to be downloaded and installed, but Google Docs can be used in any browser. You should create an account over at REPL.it. That will allow you to automatically save your programs (just like with Google Docs) and to complete assignments in future lessons.

The white panel — editor — is for your programs. The contents is saved automatically by REPL.it as long as you’re logged in. The dark panel — console — is for interactive communication with the interpreter. Through that panel the interpreter can produce text for us to see. Pressing tells the interpreter to "run the program written in the editor." Without pressing "RUN", the interpreter wouldn’t even know your program exists. Once you press "RUN", the interpreter does the following:

  1. Reads your program, one line at a time.
  2. Tries to understand it, constrained by syntax rules.
  3. If code is valid, does whatever the code says to do.

Pressing while the editor is empty yields no significant effect. An empty program is valid, similar to when you're not speaking, you're making no mistakes.

The console is multi-purpose:

  1. It can show output when instructed by code in the editor.
  2. The interpreter uses it to inform you about errors. Those messages are generated automatically and usually contain the word "error".
  3. You can also write your code in it. "RUN" wouldn’t affect such code, instead you’d have to press Enter on your keyboard. This way of writing programs is slightly different than writing in the editor, and it makes sense under certain circumstances. You’ll learn about it later. For now, write your programs in the editor only.

We will sometimes include an embedded version of this intermediary app in the lessons. Its layout is slightly different, but otherwise, it’s the same as the one you had opened via a link earlier. If you're logged in at REPL.it, the embedded projects might be automatically copied to your REPL account. You can see all of your projects at https://repl.it/repls. Here's a quick overview of its interface elements:

We recommend you to play around, click on buttons and get used to the layout. Don't worry, it's impossible to break it or do any harm to your computer, but be cautious about it. There are ways to share your information, create accounts on other services, etc. We’ll cover these things later.

A note of caution

When you open the lesson page which has a REPL, the original, teacher's version is always loaded. You can edit it, which automatically creates your personal copy. Find all your personal REPLs at repl.it/repls. Note that lesson pages never load your personal REPLs, only teacher's REPLs.

Also note that when you edit a REPL on the lesson page and then navigate away to another lesson, the browser may show a message like . The browser is just confused about the REPLs input field, and it doesn't mean that your changes will be lost. Simply press "leave" to continue.

REPL.it is very good and extremely convenient. But, like any software, there are sometimes glitches. If something weird happens (e.g. a lot of technical gibberish text is unexpectedly shown in the console; or the loading never ends), try reloading the web page.