Difference Between end and sep in Python
Parameter | Function | Default Value | Usage Example |
---|---|---|---|
end | Specifies what should be printed at the end of the output. | ‘\n’ (newline character) | print(“Hello”, end=’!’)<br>Prints “Hello!” with an exclamation mark at the end. |
sep |
Specifies what separator character should be printed between multiple values. |
Space character (‘ ‘) |
print(“apple”, “banana”, “cherry”, sep=’-‘)<br>Prints “apple-banana-cherry” with hyphens between each value. |
Difference between end and sep in Python
In this article we will discuss the difference between The end and sep are two parameters in Python’s built-in print() function that will help to control how the output is formatted.