The journey begins
Welcome to your first day of 30 Days of Python! I'm excited to guide you through this course! Whether you're new to Python or you want to review the fundamentals, I'm sure you'll enjoy this series.
In this post you'll set up your environment so that you're ready for the first day of Python content.
The first thing is to set up a development environment. You need a place to actually write code, and also a way to run your code. Often, development environments also give you tools to find and fix problems in your code.
In this series we’ll be working in an online editor called repl.it, which comes with everything you need to get started. You don’t even need to make an account, although I’d recommend you make one anyway.
If you already have a preferred development environment, such as PyCharm or VS Code, you’re more than welcome to use that instead!
For everyone else, here are a few things you need to know about using repl.it.
How to use repl.it
Creating a repl
Repl.it organises projects into workspaces called repls. We can create repls for many different programming languages, but in this series we will only use "Python" repls.
To create a new repl, 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. If you create an account, it'll be easier for you to find past repls since they'll all be listed under your profile.
After clicking the button, you’ll get a pop up which looks something like this:
The drop down menu on the left gives us a whole host of different repl types we can make. There may be more than one type of Python repl. 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 that's very different than Python 3. Some features we’re going to be talking about wouldn't work.
You can give your repl a name, which can be useful for organisation. If you leave this field blank, repl.it will name it 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, you can do a bit of extra configuration to make Repl.it ready for Python development.
Click the little gear icon on the left hand side of the screen. That displays a pop out menu like this:
There’s only one important setting to change here: 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), and Python’s standard style stipulates that we use four spaces. You should 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 appears) below the code, so I change the layout setting to “stacked”. Feel free to play around and decide which layout you prefer.
Font sizes range from extremely small to unreasonably large, so choose one that is comfortable to read.
The final thing worth mentioning is the theme. By default, repl.it uses a light theme, but if you’re a night owl like me, you can change the theme to “dark”.
Running your code
Once you’ve written some code and you want to run it, press the “run” button in the top bar. It's important to be aware of is what is going to run.
Repl.it will always run the file called
main.py, which is added for us when we create a new repl. For this reason, I’d recommend you create a new repl for every new program you want to write. If you want to keep things organised, you can make use of the built-in folders for grouping repls.
Sharing your code
One of the fantastic 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.
For more information about how to use and configure Repl.it, you can read their extensive documentation pages.
Now that we're done setting up, we can start writing Python code! Hopefully set up was relatively painless, and I hope you enjoy the rest of the series!
Get started with day 1 here.