In this example, you will learn to print output without a newline.
To understand this example, you should have the knowledge of the following Python programming topics:
Using end keyword
# print each statement on a new line
print("Python")
print("is easy to learn.")
# new line
print()
# print both the statements on a single line
print("Python", end=" ")
print("is easy to learn.")
Output
Python is easy to learn. Python is easy to learn.
Using the end keyword, you can append a string at the end of the print text. In the above example, we have passed a space with end, which adds a space at the end of the line and concatenates the content of the next print statement.
Related posts:
Python Set remove()
Python Functions
Python max()
Python classmethod()
Python sum()
Python List clear()
Python Program to Find Armstrong Number in an Interval
Python Program to Find the Largest Among Three Numbers
Python Dictionary fromkeys()
Python Program to Randomly Select an Element From the List
Python Program to Split a List Into Evenly Sized Chunks
Python Program to Convert Celsius To Fahrenheit
Building Machine Learning Systems with Python - Willi Richert & Luis Pedro Coelho
Python Program to Differentiate Between del, remove, and pop on a List
Python Matrices and NumPy Arrays
Python Program to Solve Quadratic Equation
Python Global Keyword
Python Program to Append to a File
Python Set update()
Deep Learning with Python - Francois Chollet
Python Program to Represent enum
Python Set add()
Debug a JavaMail Program
Python Machine Learning Second Edition - Sebastian Raschka & Vahid Mirjalili
Python callable()
Deep Learning from Scratch - Building with Python form First Principles - Seth Weidman
Python Set difference()
Python String isalpha()
Python Closures
Python Program to Find All File with .txt Extension Present Inside a Directory
Python Dictionary pop()
Python String isidentifier()