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 String maketrans()
Machine Learning with Python for everyone - Mark E.Fenner
Python bytearray()
Python Program to Remove Duplicate Element From a List
Python Program to Convert Celsius To Fahrenheit
Python globals()
Python Shallow Copy and Deep Copy
Python locals()
Python Object Oriented Programming
Python String splitlines()
Python Set isdisjoint()
Python Input, Output and Import
Python Program to Find HCF or GCD
Introduction to Scientific Programming with Python - Joakim Sundnes
Python Program to Create Pyramid Patterns
Python String isalpha()
Python Program to Iterate Through Two Lists in Parallel
Python del Statement
Python Program to Find the Square Root
Python bytes()
Python Generators
Python iter()
Python Program to Find the Factorial of a Number
Python print()
Python Directory and Files Management
Python abs()
Python object()
Python String casefold()
Python String swapcase()
Python Package
Building Chatbots with Python Using Natural Language Processing and Machine Learning - Sumit Raj
Python Global Keyword