Create a new file in your editor of choice called ex_1_output.py

Enter the code shown below.

We are using the print function. You can identify functions in Python as they have ( ) after the function name.

The print function takes one or more arguments (stuff inside the brackets). In this example it has one string (piece of text). Strings are enclosed in either ” ” or ‘ ‘.

print("You ran a Python program!")

Save your file and press F5 to run the code.

Or go to the Run menu and select Start Debugging.

Modify the program so that it prints out the following:

Hello World!

Create a new program that will print out the school motto.

Altiora Peto

If you want to have more than one piece of information in the print function use a comma , to separate the values.

print("Hi","Bob","I'm a computer, BEEEP.")

A common first program is to have the program print “Hello World”. This is shown below.

print("Hello World")

Modify the program to display the following:

Kia ora motu

You might also like