On 07/01/16 13:40, Sarah Rasco wrote: > In IDLE, I typed print ("Hello, world!") and hit enter, and it returned the > message. I saved the file as hello.py in C:\python. Then, when I tried to > run it in IDLE, I got a syntax error and it highlighted the '5' in the > prompt 'python 3.5.1'.
I suspect you have accidentally saved the session instead of your program. To save a program you need to go to File->New menu and select a Python script. That opens a new editor window (No >>> prompt). Type your code (the print line in this case) into the editor window. Now use File-> SaveAs to save your file as whatever you want to call it (hello.py in this case) Now you can either use the Run menu or execute it from the CMD box The File->Save from the Python shell window saves everything you have typed and that Python has printed. That is occasionally but not often useful. For program code you need a new editor file HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor