"Hello World (Local)" Exercise

Learning Objectives

In this exercise, we'll practice using the local development environment to create, edit, and execute a simple Python program.

Prerequisites

This exercise assumes you have already done the Command-line Computing Exercise.

Instructions

  1. Use your text editor to create and save a new file on the Desktop called "my_script.py".

  2. Use your text editor to write some Python code (like the example code below) in the file.

  3. Remember to save the file (anytime before running)!

  4. From your command-line application, ensure your Anaconda "base" environment is active.

  5. From your command-line application, execute the file (python ~/Desktop/my_script.py) to see its output.

Example Python code:

# This is some example python code
# These lines starting with # are "comments"

print("HELLO WORLD!")

x = 2 + 2
print(x)

Success Criteria

Once you see the printed messages in your command-line application, you have succeeded. Edit the file (by changing the message or the numbers), save it again, and run it again. Repeat this process more time for good measure.

Last updated