prev next 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

Running Your Program

Go back to Terminal. If you are still in python, press control-D to get out. Arrange your windows so you can see TextEdit and Terminal at the same time.

The magic way to make a file into a program is "chmod +x filename" like this:


laptop:~ student$ chmod +x Desktop/game.py
laptop:~ student$  

The "chmod" command stands for "change mode" and "+x" means "make it executable." You just marked your file as a program.

Now you can run your program by typing its name.


laptop:~ student$ Desktop/game.py
time to play hangman
laptop:~ student$  

That's it. You've made your first program!