📚

Custom Separator

Printing Multiple Values

You've learned to print one thing. But what if you want to print several things at once? You can give

print()
multiple values by separating them with commas:

print("My name is", "Alice")
# → My name is Alice

Notice that Python automatically added a space between "My name is" and "Alice". That space is called the separator, and it's added between every value you pass to

print()
.

Changing the Separator

What if you don't want spaces? Or you want dashes, or commas? That's what the

sep
parameter does — it lets you choose what goes between each value:

print("2025", "03", "05", sep="-")
# → 2025-03-05  (dashes instead of spaces)

print("red", "green", "blue", sep=", ")
# → red, green, blue  (comma + space)

print("no", "gaps", sep="")
# → nogaps  (nothing between them)

The

sep
part is optional — if you don't include it, Python uses a space by default.

💡

💡 Key Idea:

sep
stands for "separator." Write
sep=""
for no separator, or
sep="-"
for dashes — it's up to you!

main.pySandbox
main.py