DG

dhirendra_gupta

Student at BIT Mesra July 31, 2020, 12:13 p.m. ⋅ 207 views

Python end parameter in print()


print() function in python prints a new line in the end by default. Sometimes we might don't want this behaviour, we may want to print nothing, or an space or maybe some other character. For things like this, we have end parameter in python.

end parameter in python print() function is used to specify the end character to be printed after the given string has been printed.

Have a look at examples.

# ends the output with a <space> 

print("Hello" , end = ' ') 
print("World", end = ' ') 

#Outputs Hello World


print("Hello" , end = '_') 
print("World")


#Outputs Hello_World

 

If we don't specify any end parameter with print() function, then by default, it's a new line character i.e '\n'.

print("Hello")
print("World")

Outputs

Hello
World

 



Go back to feed

HackersFriend Updates





View more


Events


Nov. 28, 2018, 5:30 p.m.

Python from zero to hero

place Delhi

View details


Aug. 13, 2018, 5:30 p.m.

Python from zero to hero

place Bangalore ( HackersFriend office BTM Layout)

View details