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 Program to Trim Whitespace From a String
Python Functions
Python isinstance()
Python Program to Get the Class Name of an Instance
Python Program to Get the Full Path of the Current Working Directory
Python Program to Find the Factorial of a Number
Python bytearray()
Python Program to Find All File with .txt Extension Present Inside a Directory
Python String rindex()
Python List pop()
Python format()
Python Program to Find HCF or GCD
Python Program to Swap Two Variables
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python type()
Python Program to Find the Factors of a Number
Python Function Arguments
Python String lower()
Machine Learning with Python for everyone - Mark E.Fenner
Python Program to Find ASCII Value of Character
Python Tuple
Python Dictionary
Python String ljust()
Python Program to Check Whether a String is Palindrome or Not
Python String lstrip()
Python Program to Extract Extension From the File Name
Python Program to Get Line Count of a File
Python Program to Check Leap Year
Python while Loop
Python Dictionary copy()
Python Program to Delete an Element From a Dictionary
Python Program to Print the Fibonacci sequence