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 Check If a String Is a Number (Float)
Python String casefold()
Python Program to Check if a Number is Positive, Negative or 0
Python Program to Shuffle Deck of Cards
Python @property decorator
Python Program to Display the multiplication Table
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python hasattr()
Python callable()
Python String ljust()
Python delattr()
Python String isidentifier()
Python Program to Multiply Two Matrices
Python if...else Statement
Python Program to Find the Factorial of a Number
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python Set difference()
Python slice()
Python Program to Check Prime Number
Python Program to Copy a File
Python Dictionary get()
Python Set difference_update()
Python Program to Capitalize the First Character of a String
Python print()
Python Program to Print Hello world!
Python Set symmetric_difference()
Python staticmethod()
Python time Module
Python Program to Count the Number of Each Vowel
Python round()
Python Program to Check Armstrong Number
Python Program to Add Two Matrices