Home CPSC 110

Lab 1: Hello World

 

Objective

To get Python installed and configured on your computer, and gain experience writing, executing and turning in Python code.


 

Getting Set Up

For the first part of this lab, you should go through the instructions in Chapter 2 to get Python installed on your computer.

You should also read through to understand how the shell window and file window work.


 

Part 1: Explore the Shell

We will start with putting some Python code into the shell window. Try putting the following into the shell window and see what happens:


 

Part 2: Create a Program

Now we will look at saving and running a program in the top area Thonny gives us. You should start with the "Hello World" program from the reading. Copy it into the file window:


# this is our first program
print("Hello World!")

Run the program and make sure it prints the message for you. Then you should change the program so that it prints out your name instead.

Then add another line that prints out any message you like! Run the program again and make sure that your message appears.

Be sure that you are writing your program into a file and not the shell. You should save the file as something ending in .py, and be sure to save it some place you can find it again.


 

Submitting

When you are finished, please submit the .py file for the lab on Canvas. To do so, you'll need to navigate to where you saved the file on your computer.

Copyright © 2024 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.