0 votes
in Python by
Can you please explain what is the purpose of “end” in Python Language?

1 Answer

0 votes
by
Python Language’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 = ' ')  

print("Python Language")

# Printing a dot in the end.

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

print("com", end = ' ')

The output is:

Let's learn Python Language

Learn to code from madanswer.com

Related questions

0 votes
asked Aug 30, 2020 in Python by sharadyadav1986
0 votes
asked Aug 30, 2020 in Python by sharadyadav1986
...