There are many commands available to you in Python. These commands are called functions. The print function displays a message to the user (it “prints” the message to your screen). As you’ve seen, you can use it like this:

print('I like cheese')
I like cheese

Using a function like this is called calling a function. You call a function by adding parentheses at the end. You can give information to the function by putting things inside the parentheses. Each piece of information we give to the function is called an argument. (Why is it called an argument? I don’t know). Above, we passed only one argument (a line of text) to print.

When you pass text as an argument, make sure you put quotes around the words. If you don’t, you’ll get an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'hello' is not defined

You don’t need to put quotes around numbers, though:


You can use either double or single quotes; it doesn’t matter:

print("hello there")
print('hello there')
hello there
hello there

We can pass multiple arguments to a function by separating the arguments with commas, like this:

print("one", 2, "three")
one 2 three

Notice the difference between these two lines:

print("foo", "bar", "baz")
foo bar baz

print automatically puts a space between each argument.


When you see examples like the ones above, try typing similar commands on your own. Often, things will not make sense until you do it yourself.


Make sure to type things exactly. If you mess up one character, the program will usually crash.

previous: installing python next: variables