First Python Program Print Hello world

To print anything in python we use print() method. There exists many ways to print hello world (any string) in python, mentioned below.

Using Command Prompt

Go to search panel and type ‘cmd’ or ‘command prompt’ and select the first option that appears like a blackboard. Now as we have already have python installed in our system just type the command ‘py’. You can now see the version of python and these >>> ,yes that where we have to write print() method. Mention the string hello world within the round brackets of print() method in single or double quotes.

In above mentioned examples semicolon(;) is optional, the string hello world can get printed with or without semicolon. Below mentioned syntax is invalid.

Using a .py file

Its simple, open notepad and just place the below mentioned code, save that file with .py extension. Then open command prompt type this command – python

print("hello world")
print("hello world");
print('hello world')
print('hello world');

Here cd desktop command was used because the file was in desktop.

Leave a Reply

Your email address will not be published. Required fields are marked *