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 Solve Quadratic Equation
Python Program to Get File Creation and Modification Date
Python Program to Measure the Elapsed Time in Python
Python if...else Statement
Python len()
Python Program to Shuffle Deck of Cards
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
Python String translate()
Python Set intersection_update()
Python isinstance()
Python String isdigit()
Python Dictionary setdefault()
Python Set discard()
Python Program to Find HCF or GCD
Python timestamp to datetime and vice-versa
Python datetime
Python String format()
Python String swapcase()
Python Program to Print Colored Text to the Terminal
Python String isidentifier()
Python frozenset()
Python reversed()
Python Tuple index()
Python Dictionary clear()
Python zip()
Python chr()
Python dir()
Python delattr()
Python Program to Print Hello world!
Python List count()
Python Object Oriented Programming
Python String lstrip()