Python print() Function – Hello World!

Python Language is encouraged programmers to write a program without boilerplate code. The simplest directive (instruction or command) in Python is the “print” directive. The Python Print() simply prints out a line with includes a newline (unlike in JAVA – println() and C needed extra code). To print strings, numbers, etc, In Python 3 + is it too easy, just write print(“Hello World”).

Python print() Function - Hello World! - Learn Python

Syntax 

It’s a Simple Python statement hello world output Example.

print("Hello World")

Output: Hello World

Some more Examples

Here is some example of how you can print content as per requirements.

The print blank line in python :

How to print 5 or more blank lines

print(5 * "\n")

Print more than one object :

You can print easily one more object in print() function like this

print("Hello,", "how are you?")

Output: Hello, how are you?

Specify the separator:

In Python, it’s easy to separate output messages using sep="-" like this

print("Title", "Description", sep=" - ")

Output : Title – Description

Python programming language is very easy, it’s just like a general speaking language. As you know every programming language has its own syntax, so it really needs you to learn and do the practice of syntax.  Print the output in console maybe your firth program, how to print a hello world in python or Python first program.

Do comment if any doubt, suggestion or example for same.

Note: This example (Project) is developed in PyCharm 2018.2 (Community Edition)
JRE: 1.8.0
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

Python 3.7

All examples are in Python 3, so it may change its different from python 2 or upgraded versions.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.