January 4th, 2014, 01:09 PM
Python Beginner, Mac help - running python programs in MacOs
New to the Python language, and to any code language at that (excluding bad websites in the 00s involving lots of scrolling marquees and animated cursors)
Anyhow, I'm trying to learn python from Michael Dawson's 'Python programming for the absolute beginner'. However, I've run into a snag as the book is intended for a windows user whereas I have a macbook. Have read a few helpsheets else where and tried using terminal, but the thing is I'm not used to the terminology etc. have followed these instructions and hasn't worked.
How do I run a python program on a Mac directly, That runs this correctly
# Game Over
# Demonstrates the print function
input("\n\nPress the enter key to exit.")
When running in Idle it just prints it, pressing enter doesn't exit the program as the book says it should as its in interactive mode.
Someone please advise, I'm feeling like a class-A idiot right now. Would like to move past chapter 1, haha.
January 4th, 2014, 01:23 PM
You succeeded with the lesson, proceed to the next.
When a program intended for Microsoft Windows ends in
"press enter to exit"
it is just an assumption that the windows console user doesn't know how to adjust the settings for "DOS command windows" to remain open after the program terminates. Otherwise, running the program would flash by so fast the windows user might see nothing at all.
I don't have a Mac. Your OS10 is some unix variant. I don't know if python is on your PATH . From a unix terminal console run your program using the command
($\ is the shell prompt)
$ python file.py
You used some editor to create a text file named
[/code] are essential for python code and Makefiles!