Hello World - Python

Updated on 11 May, 2020

Hello World!

Python is one of the most powerful programming languages (in many cases the most) in the world right now. Python has wide range of application areas, some of them are web applications, desktop GUI applications, software development, scientific and numeric, business applications, console based application, audio or video based applications, 3D CAD application etc. Python is very simple with easy syntax. So any non-programmer can start start learning programming with Python as their first language. The simplest directive in python is "print" directive. It simply prints a line with a newline character attached to the end unlike in C programing language.

There are two major versions of python, Python 2 and Python 3. There are quite different. But you don't need to worry to choose. Python 2 was discontinued on January 1, 2020. So the choice is straightforward - Python 3. Versions of python 3 are also present but we will use the most stable version - Python 3.7.4 (at the time of writing this tutorial).

Python Program to Print Hello World
To print a string in python 3 just write the following line of code
print("This line will be printed")

Output:

This line will be printed

Indentation

Python Indentation
There is one more basic and important thing you must know - Indentation. To specify a block of code python uses indentation instead of curly braces. You can either use tab or spaces, both are supported but the standard python way to specify indentation is with four spaces.

Example

y = 10
if y == 10:
    # four spaces indented
    print("Y is 10")

Output:

Y is 10

Please share this tutorial on your social media profile and comment your queries using POST A COMMENT button below. Also if you feel this tutorial needs to be corrected or missing something please comment.

Comments