It is set by default that in Python print() function will end when a new line starts. There is a parameter known by the name ‘end’ whose value is ‘\n’ by default. This statement is found useful when we want to end a statement with a particular string or character in python for data science.
Note: This function won’t work in Python 2. So, only use it when in Python 3.
# ends the output with a <space>
print(“Learn Python at” , end = ‘ ‘)
print(“PST Analytics”, end = ‘ ‘)
Learn Python at PST Analytics
Let’s look at another example. This time with a different character.
# end function with the output ‘@’
print(“Python, SAS and Tableau” , end = ‘@’)
Python, SAS and [email protected] Analytics