The Hello World Program in Python.
Hello, World is always the first program to show, how we can write program code and execute. Similar we do in python, so start our journey to learn python.
Code for Hello World
#This is the first program a programmer would develop #to understand the program structure. print("Hello World");
D:\Python Examples>py HelloWorld.py Hello World D:\Python Examples>
What is after #? It is a simple English langue but didn’t make any impact on the program? Yes, this is a comment. A comment itself, not an executable statement. A programmer uses, comments to add descriptions.
To display a “Hello World” string, there is a print function. It takes a string as an argument and sends the output on the console.
A string is a sequence of characters, inside double-quotes.
#Program is printing two Hello Worlds print("Hello World"); print("Hello World");
D:\Python Examples>py HelloWorld.py Hello World Hello World
You can notice a major difference in the size of code. If we compare to C/C++ or Java. There is no need to include header files or import package. Interestingly the print routing adds a new line after printing argument.