Title: Print Statement & Video
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD > Section: Learning Units

Activities:

- Watch the Python print statement video (8:01 minutes), Script.
- Use these module pages to review and deepen your understanding of the concepts presented in the videos.

Python Print Statement: Characteristics

- Enables output to be sent to a screen.
- The output is specified by one or more values, separated by commas.
- The values are printed to the screen.
- By default, when the output is printed to the screen, each value is separated from the next by a space.
- Also by default, after the output is printed to the screen, the print cursor moves to the start of the next screen line.

Python print statement syntax:

print (<value-1>, <value-2>, …, <value-n>, sep="<char(s)>", end="<char(s)>")

Python print statement has 3 parts:

Values to Print to the Screen:

<value-1>, <value-2>, …, <value-n>

- Where <value-n> is any string, int, float, or bool expression.
- There may be zero or more values.

Separator characters:

sep="<char(s)>"
or
sep='<char(s)>'

Where <char(s)> are the characters used to separate one value from the next when the values are printed to the screen.

- This is an optional parameter.
- If not specified, the default separator character is the space character.

End-of-line characters:

end="<char(s)>"
or
end='<char(s)>'

- Where <char(s)> are the characters printed to the screen after all the values have been printed to the screen.
- This is an optional parameter.
- If not specified, the default end-of-line character is the newline (\n) character.