The first thing we will learn to program is a command to make Python say something. Often times, people call this "Hello World", because back when people were developing websites for the first time, it was seen as the first broadcast to the World Wide Web. Saying "Hello World" was the person's greeting to the world.


Program 1.1.1 - "Hello World"


#Displays the text "Hello World"
print("Hello World")


Create this program in Python (open IDLE, click File > New File). Once you copy it down, we can execute the program by doing the following:

  • Click on Run> Run Module (F5 is a great keyboard shortcut to remember for this!)
  • You will be prompted to save the file just like a word document
  • Save it somewhere convenient, such as your desktop or a folder specifically made for programming projects
  • Once you click save, the program will run


This is what our program is expected to do. We simply asked Python to display the text "Hello World". In future programs, we will use print statements to display errors, inform the player of events, and basically manage how everything is shown to the user. For now, we just want text to show up so we can interface with Python.


Program 1.1.2 - Displaying Text on Multiple Lines

Now that we can make text show up, let's look at some additional behaviors with print statements:


#Displays the text "Hello World"
print("Hello World")
#Displays a second line of text
print("This is line 2")
#Skips a line
#adds a fourth line of text
print("Line 4")



Simply using a print() statement asks Python to print nothing, but it still takes up one line, so we can use it to skip spaces between print statements. This will be handy later when we ask Python to display several messages at once and need to organize the display.


Assignments for this Chapter:

  1. Make a program that displays your first and last name
  2. Make a program that displays a mailing address
  3. Create some sort of picture using multiple print statements. See the example below:


Chapter 2.1 - Introduction to Variables