Open the GUI (see previous post).
In the top menu, clisk save as and give your file the name hello_world . Save it anywhere you want.
The first thing to learn is comments.
If you put the sympol # you can write text about your program and it will be ignored and recognized as notes.
So we will start with this:
# My first program to print "Hello world!" hit the ENTER key
Notice that because it is a comment it turns red.
Whenever you add something it is always good to save so you don't lose your work. Remember though that save will also overwrite you previous file. So, if you use the same name and location for 2 files you will lose the old one. It will be gone forever! Be careful. Also, if you had many hours in a project, it would be advisable to save it in stages in case you ever messed things up and wanted to go back without having to start all over. To do that, you might save hello_world 2, then hello_world 3. Even better would be to add a date such as: hello_world jan25,18 .
Next type print ("hello world") and push ENTER
This is the print function. It displays a value on the screen.
Save your work.
Getting Help in Python
If you type help() and hit ENTER, you will enter Python's help utility.
To exit the utility, type quit at the prompt and ENTER
To get help on a module, keyword, symbol ot topic, type it in the brackets. For example:
Trype help(print) to get help with the print function.
No comments:
Post a Comment