Hello World!

The name of this assignment refers to a programming tradition - that your first program in any new language will display the words Hello World on the screen. You are currently learning Python, but the actual language doesn't matter as much as the ideas that make up your program. Once you understand how to program, it is fairly easy to swap between languages.

We are going to start by using IDLE to create a console application. IDLE comes with Python, which is a relatively small, free download...

Installing Python

The Python programming environment is called IDLE and can be downloaded from the Python download page.

I recommend that you install Python 3, so that we are all using the same version. Select the version that is suited to the type of computer you are using. Most students are using Windows. If you are using 32-bit Windows, or are not sure what type of Windows you are using, download and install the Windows x86 MSI installer. Users of 64-bit Windows can download and install the Windows x86-64 MSI Installer.

Getting Started

The IDLE user interface looks like this:

IDLE User Interface

It's pretty straightforward to use. You can use it in immediate mode and type in Python commands to see what they can do, or you can select New File from the File menu to create a whole program in the editor. When you create a new file, don't forget to add the extension .py to the filename to indicate that the file contains a Python program.

Once you are usign the editor, you can type in your commands and comments - they will be colour-coded to help you to spot errors. You can run your program by pressing F5 or selecting Run Module from the Run menu. If you have not saved your program, you will be prompted to do that first.

IDLE Edit

Commands

We looked at both Python 2 and Python 3 commands in the lesson, but in the assignments we'll just look at Python 3 to keep things simple:

NB. You will only need the print() command and comments for this assignment, but you can add input to the program if you would like to extend the task.

If you are unable to install Python then you can use an IDE such as replit.com to run your programs on-line.

Your Task

Being by downloading my sample program - HelloWorld.py. Click the right-mouse button on the link and save it into your My Documents (or wherever you keep your the Ill Health Team work). If you just double-click the file, it will run (possibly so quickly that you won't see anything), so click the right-mouse button on it and choose Edit with IDLE. If you're using replit.com (or similar), then copy the program below and paste it into the editor:

print("Hello\nJoe\nBloggs!")
print("Today is Monday.") 

All I'm asking for this first assignment is for you to edit the program so that it prints information relevant to you. You will also learn how to open, save and run your programs. If you want to experiment and add extra features, then feel free!

Your program should:

  1. display your name instead of Joe Bloggs. Make sure that your name includes spaces!
  2. show the current day
  3. add a comment to the top of the program to indicate who wrote the program and when it was written.

The commands display Hello Joe Bloggs over three lines when you run the program - can you see why that happens? Is that what you'd want to see when you run the program?