Skip to content

Replit

In my Code Clubs, I use Replit for the intermediate and more advanced programming provides as it provides a full web based IDE for Python and many other languages; it also offers a free tier.

Getting started

The easiest way to get started is to head over to Replit and create an account on the free tier. There are some restrictions with the free tier that you should be aware of:

  • You can only have 10 Apps at any one time; see the section below on how to have multiple programs in a single app below how to minimise the number of Apps you need to use.
  • All of you Apps are public (to make them private you need a paid account)

Because the Apps in the free tier are public, anyone can see the code and data. Therefore, make sure you never put any personal information in your work.

How can I make my Apps private?

The only way to make your Apps private is to have a paid Replit account. Presently, the cheapest pad account is $20 per month which is prohibitively expensive for casual use or education.

Is there an education version or Replit?

No. There did used to do an Education version but Replit have closed this service.

How do I create a new Python App?

Creating a new Python App is trivial. Just follow these steps.

Click the "Create App" in the top left of the browser screen:

create app

Then follow these steps:

  1. Click the "Choose a Template" tab
  2. Start typing python in the Template box
  3. Select Python from the drop down
  4. Give your Python App a name
  5. Click "Create App"

choose template

Can I have multiple python programs in a single Python App?

Thankfully the answer to this is yes, otherwise you would quickly exhaust the 10 App limit. With Python (and this is also true for Pygame and Pygame Zero Apps), there is a simple method to use to switch which program runs in a single Python App.

The Run button at the top of the Replit screen is configured by default to execute the main.py program. With Python, each file is its own module and can therefore be its own "App". With Python, you can easily import a module from another using the import ...... statement. This will cause the code within the imported module (i.e. file) to execute.

Therefore, you can structure a single App with multiple programs, changing which one runs by modifying the main.py file in the App. The two screen shots below show a single Python App that contains three files: main.py, program_one.py and program_two.py. The first screen shot shows program_one.py being imported from main.py and executed when the Run button is pressed. The second screenshot shows program_one.py being imported from main.py and executed when the Run button is pressed.

multiple python programs

multiple python programs 2

How do I create a PyGame App?

A Pygame App is created in exactly the same way as a Python App but rather than selecting Python from the drop down menu, select Pygame.

Create a new PyGame Zero App?

This requires a few more steps.

  1. Create a Pygame App by following the steps above
  2. Delete all of the code in the mapin.py file
  3. Add the code below and click Run
  4. You should get a screen like the image below
import pgzrun

WIDTH = 600
HEIGHT = 640
TITLE = "My Pygame Zero Game"


def draw():
    screen.fill((115, 20, 0))


pgzrun.go()

pygame zero