You are here: Home / Topics / Write Hello World Program in Python

Write Hello World Program in Python

Filed under: Python on 2022-08-05 15:15:02

In python 3, we have a print function for printing any string or statement on console. Here we are able to pass our string in single,double and triple quotation .i,e all three quotation are valid and we do not require to add a semicolon at the end of the line in python because python is a scripting language like html and html also we do not use semicolon at the end of the line.

Program to display the Hello world-

print(" Hello World! ")
print("Hello","World!",sep="-")
print("Hello world!",sep="_",end="Finish")

Output--

Hello World!
Hello-World!
Hello_world!Finish

==> Here we print Hello world in three different concept. first one is simple print function and in second print function we use a term 'sep' , basically it separate the different argument by default sep is space and the third print is using the end that is use to insert element at the end of print statement.

==> There is a line break is present by default at the end of print function so we do not require to add n for line breaking and for removing the line break the code is written as

print(" Hello World! ",end="")

==> print is a function in python 3 while print is statement in python 2. 

==> In other programming language like C and Java, the execution of every program starts with the main function while in python we do not require main function, execution of every program is starts with top most line of program.

About Author:
P
Pritvik     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.