Execute a Hello World python program

First we need to write a sample code and save the file with [dot]py extension.

to print Hello World Using Python 3, we use a print function without semicolon and enclose your string in single quote or double quote or triple quote.

Ex:

print('Hello World!') 

or

print("Hello World!") 

or

print('''Hello World!''')  

The above lines prints the Hello World! as an output.  

How to Execute First Python Program?            

1. Open IDLE

open idle python

2. Click on File menu and select New File as shown in the below image. You can also press Ctrl+N keyboard shortcut to open the new file.

python idle create file

print("Hello World!")

3. Type your program in the window and save the program to your desired location with filename.py extension. File name may be anything.

print('Hello World!') 
print("Hello World!") 
print('''Hello World!''')  

 save python file

4. Click on "Run" menu Item and select "Run Module". You can see your output on Python shell.

output

That's it. You got your first output.  

You can also do the same in Python shell directly. Just type the following code and hit enter, you will get your instant output.

print('Hello World!') 

helloworld python

Now, you executed Hello World program in Python 3.