Mastery 1 – Ability to create Python file and run from command line

To accomplish this Mastery you will need to have Python, Atom and Cygwin installed (if you are a Windows user like me).

When you open Atom you will have something like this:

P1 Click where it says Plain Text.

Search for the coding language you will use (in this case Python) and click on it:

p2

Lets write a simple line of code to make an example:

p3

Save it anywhere easy to find, don’t forget to add .py after the name of your file.

Pro Tip: Avoid any complicated names.

p4

Now time to run your program! Lets open Cygwin. We need to open the directory in which our file is. For this you can use cd (change directory) and then specify the location of your file, press Enter. When you do that then you call python and the name of your file so it can run, press Enter.

Your program should run smoothly.

Mastery 2 – Ability to create Python project in IDE and run inside the IDE

Python’s IDE is called IDLE, after you installed Python you can search for it on the start search bar as such. IDLE has two main window types, Shell and Editor. When you first open IDLE you will see something like this:

i1 This is the Shell Window.

To go to the Editor Window, click on File and New File. You should get a window like this:

i2

Notice how the menu options are different.

Now on your editor window write a simple line of code:

i3

To run it you have to save first, remember to use simple names! When you are done saving your program click on Run on the menu, and then click on Run Module. The shell window should pop up with your program running:

i4

And you are done! 😀

CC BY 4.0 Masteries 1 & 2 by carminaperezguerrero is licensed under a Creative Commons Attribution 4.0 International License.