Try it here
Subscribe
Parameter "end" in print function

What is the purpose of "end” in Python

what_is_the_purpose_of_end_in_python

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("Welcome to",end=" ")
print("Python")

Output

Welcome to Python
# Printing a dot in the end.
print("Hello world , welcome to dEexams" , end = '.')  
print("com", end = ' ')

Output:

Hello world , welcome to dEexams.com 

Writer profile pic

Anmol on Apr 22, 2020 at 12:04 am


This article is contributed by Anmol. If you like dEexams.com and would like to contribute, you can write your article here or mail your article to admin@deexams.com . See your article appearing on the dEexams.com main page and help others to learn.



Post Comment

Comments( 0)

WEB TECHNOLOGY

Articles

×

Forgot Password

Please enter your email address below and we will send you information to change your password.