Heads up! To view this whole video, sign in with your Treehouse account or enroll in your free 7-day trial. Sign In Enroll
Well done!
      You have completed How to Install Python (macOS)!
      
    
You have completed How to Install Python (macOS)!
Preview
    
      
  Get to know Python’s built-in text editor, IDLE, to use for writing and exploring Python.
Resources
Cheer function
def cheer(name):
    for letter in name:
        print(f"Gimme a {letter}!")
    print("What does that spell?")
    print(f"{name}!")
user_input = input("What's your name? ")
cheer(user_input)
Code Editors
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
                      Your Python installation comes with
a code editor that we can use right away.
                      0:00
                    
                    
                      It's called IDLE, which stands for
Integrated Development and
                      0:06
                    
                    
                      Learning Environment.
                      0:10
                    
                    
                      If you're just starting
out with Python and
                      0:12
                    
                    
                      you want a quick code editor to learn
some basics, IDLE is a great choice.
                      0:15
                    
                    
                      IDLE should already be installed
when you installed Python.
                      0:21
                    
                    
                      So you can search for
IDLE using Spotlight.
                      0:25
                    
                    
                      Launch the application.
                      0:30
                    
                    
                      To compare and
contrast IDLE with an online code editor,
                      0:32
                    
                    
                      I will also open Treehouse Workspaces.
                      0:37
                    
                    
                      If you've been using
a different online editor,
                      0:40
                    
                    
                      you'll find that the features
are mostly the same.
                      0:43
                    
                    
                      By default, IDLE opens a shell window,
                      0:47
                    
                    
                      which is similar to our workspaces
console when running the Python shell.
                      0:50
                    
                    
                      Let's make sure the Python shell is
running on our workspace's console.
                      0:56
                    
                    
                      Type python3 and press enter.
                      1:01
                    
                    
                      You're able to enter Python
code directly into the shell,
                      1:05
                    
                    
                      such as print("Hello World").
                      1:11
                    
                    
                      Let's do the same in our IDLE.
                      1:15
                    
                    
                      print("Hello World").
                      1:18
                    
                    
                      We can see that the outputs
are exactly the same.
                      1:23
                    
                    
                      Be sure to check the teacher's notes if
you're not sure what the Python shell is.
                      1:27
                    
                    
                      There's not much we can do with just the
Python shell, so let's create a new file.
                      1:33
                    
                    
                      We can do that by clicking on File,
New File.
                      1:39
                    
                    
                      Be sure to save this file
by going to File, Save.
                      1:46
                    
                    
                      Let's call it app.py and
save it in our Documents.
                      1:53
                    
                    
                      This is similar to us creating
a new file in Workspaces,
                      2:00
                    
                    
                      so let's do that over there as well.
                      2:05
                    
                    
                      File, New File, app.py.
                      2:08
                    
                    
                      I'm going to use a simple function and
                      2:18
                    
                    
                      function call which you can
copy from the teacher's notes.
                      2:20
                    
                    
                      Be sure to save both files.
                      2:27
                    
                    
                      File, Save and
over in Workspaces, File, Save.
                      2:31
                    
                    
                      Unlike Workspaces, IDLE doesn't give
us line numbers by default, and
                      2:39
                    
                    
                      the syntax highlighting
uses different colors.
                      2:44
                    
                    
                      Let's have a look at IDLE settings.
                      2:48
                    
                    
                      You can see that we can change the font,
the colors,
                      2:55
                    
                    
                      and some other advanced settings.
                      3:00
                    
                    
                      This is one of the many benefits
of a local code editor,
                      3:03
                    
                    
                      you can really customize your
development environment.
                      3:08
                    
                    
                      I prefer a slightly larger font size,
so let's do that.
                      3:12
                    
                    
                      In workspaces, you can run your file in
the console by typing python3 app.py.
                      3:21
                    
                    
                      But first, let's exit the shell.
                      3:28
                    
                    
                      Let's type python3 app.py.
                      3:33
                    
                    
                      What's your name?
                      3:38
                    
                    
                      Let's enter my cat's name,
Rubik, and press enter.
                      3:40
                    
                    
                      Here we have the printed
results of the cheer function.
                      3:46
                    
                    
                      Over in IDLE, with our app.py open,
we'll click on Run, and
                      3:50
                    
                    
                      Run Module,
this will now run in the Python shell.
                      3:56
                    
                    
                      Let's enter my other cat's name, Pickle.
                      4:02
                    
                    
                      And we have the printed output once again.
                      4:06
                    
                    
                      As you become more advanced
in your Python skills,
                      4:10
                    
                    
                      you'll find that IDLE won't quite
meet the needs of your development.
                      4:13
                    
                    
                      There are some great code editors out
there that will be more applicable to your
                      4:18
                    
                    
                      workflow.
                      4:22
                    
                    
                      Be sure to check out the teacher's
notes for some options.
                      4:24
                    
                    
                      Congratulations, you now have
a local Python installation that you
                      4:28
                    
                    
                      can use to follow along with
the courses here at Treehouse.
                      4:32
                    
                    
                      You're also one step closer to using
Python to develop software for
                      4:37
                    
                    
                      your future clients or developer role.
                      4:41
                    
                    
                      The Python world is at your fingertips.
                      4:44
                    
              
        You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up