Editor

Print with a Custom Separator

Beginner · Write the code · from Python Input and Output: print(), input(), and Formatting

From the lesson: Python Input and Output: print(), input(), and Formatting

Every program needs a way to talk to the outside world. A weather app shows temperatures. A game displays your score. A calculator prints answers. All of these use output.

Read the lesson

Print the words "red", "green", and "blue" separated by - (space dash space) using the sep parameter of print().

Expected output:

red - green - blue

Use a single print() call with the sep parameter.

# Print "red", "green", "blue" with " - " as the separator

More Input and Output exercises

All Python exercises · 50 practice problems · Python Fundamentals quiz