Go to: Na-Rae Han's home page  

Python 3 Notes

        [ HOME | LING 1330/2330 ]

Trying out Python for the First Time: Mac

<< Previous Note           Next Note >>

How-to Video


**Click the icon on bottom right to view full-screen.

Summary

  • IDLE is the environment in which we will be spending most of our time. Let's check it out.
  • You can access IDLE through Launcher.
  • The IDLE shell window opens up. You can type in print("hello!") and so forth, and the shell will do the printing. As you can see, it's interactive. Python responds to every line of code you enter.
  • Opening up a new window will create a script file window. Here, print("hello!") does not immediately produce output. That is because this is a script file editing window, which means the commands won't execute until the file is saved and run.
  • You can run the script by going "Run --> Run Module" or simply by hitting F5 (or Fn + F5 on most Macs).
  • Before running, IDLE prompts you to save the script as a file. Choose a name ending in .py ("hello.py") and save it in the Documents folder.
  • The script will then run in the IDLE shell window. Since you now have a saved script, you can run it again (and again).
  • How about the file "hello.py"? Will double-clicking it do anything? Yes it does -- it opens right up in IDLE.
  • You can open up your saved script file, edit it some more, and then run it again.
  • Rather than going through the menu button, learn to use F5 (or, Fn + F5) to run your script. It's much quicker.