Welcome to day 0 of the 30 Days of Python series! In this post we're going to be getting set up so that we're ready for the first day of Python content.

Before we can start writing any Python code, we need to set up a development environment. This is going into include an editor, where we’ll actually write the code, and some tools for debugging and running our Python programs.

For the entire 30 Days of Python series, we’re going to be working in an online editor called repl.it, which includes everything we need to get started. We don’t even need to make an account, although personally I’d recommend you make one anyway.

If you’ve already installed Python locally, and you’ve already set up another editor like PyCharm or VS Code, you’re more than welcome to use your local setup instead, and you can move straight onto the first day of content.

For everyone else, here are a few things you need to know about using repl.it.

Creating a repl

Projects on repl.it are organised into workspaces called repls. Repl.it actually offers repls for many different programming languages, but we need to make sure to create a Python repl.

To create a new repl, we just need to click the “new repl” button in the top right hand corner of the page. You can do this whether you’re logged in or not, but creating an account gives us better ways to find and organise our repls later on.

After clicking the button, you’ll get a pop up which looks something like this:

https://i.ibb.co/9q2JJzw/Screenshot-from-2020-01-29-12-48-26.png

The drop down menu on the left gives us a whole host of different repl types we can make. Notably, we have more than one type of Python repl we can make. We want to select the option which says “Python”, which will create a standard Python 3 repl.

Make sure you don’t select Python 2.7, as there are some significant syntax differences between Python 2 and Python 3, and some features we’re going to be talking about simply won’t work.

If you like, you can name your repl, which can be useful for organisation, but if you leave this field blank, repl.it is going to name the repl for you.

Click “Create Repl” when you’re done, and you’ll be taken to your new workspace.

Some additional configuration

Once you’re inside your new workspace, we can do a bit of extra configuration to make repl.it ready for Python development.

We can access a number of settings on the left hand side of the screen, where we’ll find a little gear icon. Opening it will give us a pop out menu like this:

https://i.ibb.co/C5DXfpH/Screenshot-from-2020-01-29-13-03-37.png

There’s only one important setting to change here, which is the indent size. This affects how many spaces get added when we press the tab key. Indentation is very important in Python (as we’ll soon see), so we’ll be doing this a lot, and Python’s standard style stipulates that we use four spaces. We therefore need to change indent size to “4”.

There are also some optional changes we can make in this menu. I like to have the console window (where our code's output will be shown) below the code, so I change the layout setting to “stacked”. Feel free to play around and decide which layout you prefer.

You can also change the font size from very small to unreasonably large, so choose whatever you find most comfortable to read.

The final thing worth mentioning is the theme. By default, repl.it uses a light theme, but if you’re like me, and you prefer working with a dark editor, you can change the theme to “dark”.

Running your code

Once you’ve written some code and you want to run it, you need to press the “run” button in the top bar. This is all pretty straightforward, but one thing you need to be very aware of is what is going to run.

Repl.it is always going to run the file called main.py, which is added for us when we create a new repl. For this reason, I’d recommend you start a new repl for every new program you want to write. If you want to keep things organised, you should make use of the built-in folders for grouping repls.

Sharing your code

One of the really cool things about repl.it is that it makes it very easy to share your code with other people. All you have to do is share the link to your repl. Don’t worry, the people you share it with won’t be able to edit your work.

If you get stuck with something, I’d recommend you join our Discord server and share your code there, but you can also share your repl with us on Twitter.

Further information

If you want more information about how to use and configure repl.it, there are some extensive documentation pages you can check out.

And we're done!

With that we're done setting up repl.it, and we can start writing some Python. Hopefully set up was relatively painless, and I hope you enjoy the rest of the series!

Get started with day 1 here.