Getting Started in Python

Output

You don’t have access to this lesson
Please register or sign in to access the course content.
Length: 10 minutes

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[1]. You can identify functions in Python[3] 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[4] (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[2].

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
Terms definitions
2. Debugging. Fixing errors in your programs or algorithms: There are two possible types: * a logical bug[7] is an error which means that the computer is able to carry out its instructions, it doesn’t act as the programmer intends it to be * a syntax bug is an error caused by something the programmer has typed, […]
3. Python. A type of programming[5] language. It is one of many high-level, general-purpose programming languages. It was first released in 1991
4. string. A data type[6] used to store text. Often enclosed in “” or ”
Terms definitions
1. function. Length: 10 minutes 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 […]
2. Debugging. Length: 10 minutes 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 […]
3. Python. Length: 10 minutes 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 […]
4. string. Length: 10 minutes 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 […]
5. programming. Length: 10 minutes 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 […]