How to use 'end' with multiple arguments?

QuestionsQuestions8 SkillsProPython Control StructuresNov, 17 2025
0102

When using the print() function with multiple arguments, you can still use the end parameter to control what is printed at the end of the output. The print() function automatically separates multiple arguments with a space by default, but you can change this behavior using the sep parameter.

Here's how you can use both end and sep together:

print("Hello", "World", "from", "Labby", sep='-', end='!')

In this example:

  • sep='-' specifies that the arguments should be separated by a hyphen (-).
  • end='!' specifies that the output should end with an exclamation mark (!).

The output will be:

Hello-World-from-Labby!

This way, you can customize both the separation between arguments and what is printed at the end of the output.

0 Comments

no data
Be the first to share your comment!