Hello World Program in Python

Hello world program in Python programming. In this tutorial, you can learn how to write the hello world program in Python programming language using different ways.

Program Printing Hello World

The following program will print Hello World on the output screen.
You can also use single quotes like print('Hello World')

Program

print("Hello World")
Output
Hello World

Program Printing Hello World in Two Lines

The following program will print Hello World in two lines on the output screen.

Program

print("Hello\nWorld")
Output
Hello
World

Program Assigning Values to Variables and Printing

Program

val = "Hello"
val2 = "World"
print(val, val2) #printing 'val' and 'val2' values.
Output
Hello World

Program Printing Two Line Word in One Line
Program

print("Hello", end="") #'end=""' used for Continue Line.
print(" World!") #it printing 'Hello World!'.
Output
Hello World!

Program Assigning Multiple Values to Variable
Program

val = "HiLaLs", "Khan", "Afridi" #assigning values to 'val'.
print(val)
Output
('HiLaLs', 'Khan', 'Afridi')

Program Assigning Value to Multiple Variables

Program

a = b = c = 5 #assigning value to 'a', 'b' and 'c'.
print(a)
print(b)
print(c)
Output
5
5
5