When I go to Idle, then to python shell then click on File and New Window, an Untitled window appears. But how do I then enter a program?
Your program is the code that you write in that window. For example - If you wanted to print the famous "Hello, world!", you would type this code in that empty window: Print "Hello, world!" You will have to save it first, before running it.
The problem I'm having is that the Untitled window really is empty, e.g., it doesn't have the characteristic >>> on it. If I type Print 'hello, world' and enter it, then nothing happens.
It's supposed to be that way. Type your code without the prompts (>>>) in that window. Save that code somewhere on your computer and then press f5, in that same window where you wrote the code, to run it. The code you just typed will run in the SHELL. Python knows automatically where the prompts are, so if you have no errors, it will do what you wrote. Think of that new window as your own .py document that you are working on until you test drive it.
Thanks Aslander, so far so good. What you said to do worked fine when I typed in Print 'Hello, world'. But when, instead, I typed in 2**3, then saved it, then typed F5, I just got >>> on the python shell without the answer. Did I do something wrong?
Dear Aslander, O.K. Thanks to you, I think I finally have it all straight now so that I can write a program, save it, run it, change what's wrong, etc. I didn't know about pressing F5 until you told me. Is that written down somewhere in the official Python intstructions? Thanks again for your help.
No - that is just a shortcut. You can find more if you open your Shell and click any menu heading like Format or Run. The keyboard shortcuts are written right beside the function you want. As for why 2**3 did not print - I am not entirely sure, but you would need to add the print command before the 2**3 to print the answer when running it. Like this: print 2**3
Thanks for all the helpful info. Can you help with this further question? When I click on IDLE that puts me into the Python Shell, all right. But I can't find any menu heading there like Format or Run. If I click on Help in the Shell then that tells me that "somehow" Format is under the Edit heading, but that seems to lead me nowhere.
Oh - The menu items I was referring to are found when you open a "New Window".
Join our real-time social learning platform and learn together with your friends!