📚
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()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
sepprint("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💡💡 Key Idea:
stands for "separator." Writesepfor no separator, orsep=""for dashes — it's up to you!sep="-"
main.pySandbox
main.py
Ctrl + Enter