DEV Community

Cover image for How to run Python IDLE on a Mac
vayola pradeep
vayola pradeep

Posted on

How to run Python IDLE on a Mac

How to run Python IDLE on a Mac

Step 1

Start by opening Launchpad

Image description

Step 2

Click IDLE. (If there's no IDLE icon to click, Python 3 may not be installed correctly.Follow these instructions to install it.

Image description

Step 3

The Python Shell opens. It's similar to the Windows, Mac, and Linux terminals. Appendix C in the book shows you how to run Python in a terminal.

Image description

Step 4

We're going to use the IDLE editor. It allows you to create a Python program that you can save. To open the IDLE editor, begin by clicking File

Image description

Step 5

Click New File.

Image description

You're now in the editor.

Image description

Step 6

Writing some code. For eg: Carefully type in this code:



import turtle
turtle.fd(100)


Enter fullscreen mode Exit fullscreen mode

The command import turtle tells Python to borrow the turtle graphics library for our program.

turtle.fd(100) means move the turtle forward 100 steps in the current direction.

Image description

Step 7

Save the program. Press ctrl-s. Save the file to the specific folder for python projects as shapes.py

Image description

Step 8

To run the shapes.py program, click Run, then Run Module.

Image description

output window opens and displays your results

Image description

Top comments (1)

Collapse
 
ankush_kumar_8f28ddbb21f4 profile image
ANKUSH KUMAR

Ankush.com