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 lessonPrint the words "red", "green", and "blue" separated by - (space dash space) using the sep parameter of print().
Expected output:
red - green - blueUse a single print() call with the sep parameter.
# Print "red", "green", "blue" with " - " as the separator
More Input and Output exercises
- Print Items on the Same LineBeginner
- Create a Multiplication TableBeginner
- Print a Formatted ReceiptBeginner
All Python exercises · 50 practice problems · Python Fundamentals quiz