03. Getting Started

Lets run our first python program “Hello Python”. You can make your program by simple test editor or Python IDE like Visual Code editor.

First program by simple text editor Notepad

Lets see how you can make and run your first Python program using Notepad and command prompt:

Program by Visual Code IDE

Lets see how you can run your first Python program using command prompt

If you want to run your python programs in Visual Studio Editor Python is installed otherwise editor will ask to install python to work in.

To create your programs simply click on the

Execution Mode

Python is an interpreted programming language. Python source codes are compiled into bytecode as a .pyc file, and this bytecode can be interpreted.

There are two modes to execute programs in Python:

Interactive Mode:

You can execute python statements or expressions directly at Python prompt without storing it in a script file. You can start python prompt by execute c:\python command then you can run a statement or execute an expression:

Here is example to start Python prompt

c:\>python

It will display

Python 3.6.0a1 (v3.6.0a1:5896da372fb0, May 17 2016, 16:07:03) [MSC v.1900 32 bit (Intel)] on win32

Type "copyright", "credits" or "license()" for more information.

>>>

Now print "Hello" by executing statement print("Hello"):

>>> print("Hello")

Hello

>>>

It will display Hello in next line at python prompt:

Now execute an expression: 

>>> 2+2

4

>>>

Do whatever you want to do with Python prompt.

Scripting Mode:

In order to execute a logic path, you can store set of python statements in a file. File will have extension .py. It is called scripting file.

We are assuming that Hello.py is the script file that has following statements:

#Hello.py

print("Hello");

print("This is my first program");

print("File name is Hello.py");

You can execute this script file with python interpreter by specifying name of the file next to the interpreter:

C:> python Hello

It will display following output

Watch Video