Visit https://atom.io and follow the instructions to install it on your computer.
Alright, by now, you should have Atom installed. You have the option
of either finding the Application or opening it up from the terminal.
Recall from Lab 0 that you can open a terminal on the school
computers by pressing
Let's first create and navigate to a directory called
the UNIX commands you learned in Lab 0:
mkdir ~/example cd ~/example
Opening a project
Now let's open up Atom!
For Ubuntu or Mac users, you'll most likely find Atom in your
For Windows users, you'll most likely find Atom in your
Click on "File > Add Project Folder..." in the menu bar. Highlight the
example folder you just made and open it. It should appear in the sidebar
as an empty folder.
Now we have Atom open, we can begin writing our first Python file. Don't worry, we don't expect you to know any Python yet! All you have to do is type in the following:
def greet(name): print('Hi', name, ', how are you doing?') print(' - Python')
Once you've finished typing, Atom should look something like this:
To save, you can just type
ctrl + s. If you haven't already, save
this file as
greet.py in the example folder. Notice that it appears in the
This will be helpful for navigating projects that are more than one file.
In this class, you will be switching between your text editor and Python a lot — writing code and testing code.
Back in our terminal, we're currently in our
Let's play around with our code. In the terminal, start by typing
python3 -i greet.py
This command does the following:
python3is the command that starts Python
-iflag tells Python to start in interactive mode, which allows you to type in Python commands from your terminal
greet.pyis the name of the Python file we want to load
Notice that the Python interpreter says
>>>. This means Python is
ready to take a command.
Recall that we defined a function called
greet. Let's see what it
does! Type in the following:
Python will then print out
Hi Michelle, how are you doing? - Python
Our code works! Let's close Python by typing in
There are a couple of ways to exit Python. You can type in
quit(). On MacOS and Linux, you can also type in
Ctrl-d(this doesn't work on Windows).
Congratulations, you've edited your first file!
For Mac users, replace all the
ctrl sequences with
ctrl+s: saves the current file
ctrl+[: indent a line or a group of lines
ctrl+]: dedent a line or a group of lines
ctrl+tab: moves you to the next tab
ctrl+shift+tab: moves you to the previous tab
ctrl+f: search for a word
ctrl+shift+f: searches through all tabs
ctrl+shift+p: This one's important. This opens up a little panel of tools! You can do things like type "ss python" which will set the syntax of your file to python or "reindent" will help you reindent a file you paste in (this will be helpful in future labs!)
This guide only scratches the surface of all of Atom's functionality. If you are interested in diving deeper into Atom, check out it's documentation! Remember, if there's something you wish Atom could do, it probably can! Just Google it!