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
1 2 3 4 5 6 7 8 9 10 | # 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
1 2 3 4 | 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 *args and **kwargs
Python String format_map()
Python open()
Python Program to Add Two Numbers
Python String lstrip()
Python iter()
Machine Learning Mastery with Python - Understand your data, create accurate models and work project...
Python List index()
Python Program to Check If Two Strings are Anagram
Python Dictionary keys()
Python Set union()
Python Dictionary values()
Python Program to Trim Whitespace From a String
Python List insert()
Python repr()
Python Program to Find HCF or GCD
Python float()
Python String isprintable()
Python Modules
Python bool()
Python Program to Convert Two Lists Into a Dictionary
Python Program to Differentiate Between del, remove, and pop on a List
Python Program to Find the Size (Resolution) of a Image
Python Program to Check if a Number is Odd or Even
Python Errors and Built-in Exceptions
Python String ljust()
Python Keywords and Identifiers
Python vars()
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python timestamp to datetime and vice-versa
Python Program to Get File Creation and Modification Date
Python ord()