Dec 14, 2019 in Python

Q: What Is The Purpose Of “End” In Python?

1 Answer

Dec 14, 2019
Python’s print() function always prints a newline in the end. The print() function accepts an optional parameter known as the ‘end.’ Its value is ‘\n’ by default. We can change the end character in a print statement with the value of our choice using this parameter.

# Example: Print a  instead of the new line in the end.

print("Let's learn" , end = ' ')  


# Printing a dot in the end.

print("Learn to code from madanswer" , end = '.')  

print("com", end = ' ')

The output is:

Let's learn Python

Learn to code from
Click here to read more about Python
Click here to read more about Insurance

Related questions

Jun 30 in Python
Dec 22, 2019 in Python
May 17 in Python