Hello World

It is customary that the first program that you write in a programming language is the "Hello World" program.

So as not to break this great tradition, let's start our Python journey there!

Python lets you output text to the Terminal.

You can output a piece of text using the print() function (more on functions later in the course).

Normally we will write out python programs in a source file (script) which is where we will write our code. You will need to create and save this file in Visual Studio Code. Make sure it has the .py extension.

1. Hello World!

For now, we can output a piece of text to the terminal by putting the following line into a Python file.

print("Hello World!")

Once you have added this line, hit the Run button at the top of Visual Studio Code.

Run Button

You should then see Hello World! outputted to the terminal.

1.1 Wow! What Just Happened?

When you hit the "Run" button, Python reads your code from the source file and immediately executes it, showing the result in the terminal. Python is an interpreted language, which means that you don’t need to compile your code before running it.

If you would like to execute manually without the run button. Go to the Terminal and type:

python <NAME OF YOUR FILE>.py

This will then convert your code for execution and then run it.

1.2 Tasks

Throughout this course, you'll encounter tasks that you should complete. These are practical exercises designed to reinforce the concepts you've just learned. Some tasks will be more challenging than others, so focus on completing the easier ones before tackling the harder ones.

A TASK will always look like the one given below.

TASKs will normally appear at the bottom of the page


=== TASK ===

Create a Python program in a new file that outputs "Hello World! is cool!" to the Terminal using the print() function.