courses > python for beginners

Python Print Function


change this to just the print statement. sep, and end

The Print Function

Single vs Double Quotes

For most instances, it does not matter if you use a single quote (’) or a double quote (”). For the most part, I tend to use single quotes by default as that requires few key strokes. The following two lines of code do the same thing.


So when does it make a difference? When the message that you want to output has a a single or double quote in it.

print("Bob said, "Come Over Here."")
print('Jack's house.')

In this example we are using double quotes to give some output. This means we can not use double quotes in the message itself. If run this code, we will get an error.

< img of error msg >

We can fix this by following a simple rule.

If there are single quotes used inside, we have to use double quotes on the outside. If there are double quotes on the inside, we have to use single quotes on the outside.

Sep Parameter

End Parameter

The Input Function

The easiest way to get input from a user is with the input command. We ask them a question and then store the answer they give us into a variable that we can then do some operation on before giving them a result.

The basic syntax of the input statement is as follows:

print('What is your name?')
ans = input()