Python 3 – Lesson 01 ( Installing python 3 and writing your first code )

Python 3 – Lesson 01 ( Installing python 3 and writing your first code )

In this lesson i am going to teach you how to install python 3 to
your mac or windows and write your first code. This lesson is part of a
series i am going to write in my website. If you have a problem with any
of my lessons, feel free to comment under my posts and i will answer
asap. First of all you need to download python 3 to your computer and
install a good IDE to write python codes. In this tutorial series i am
going to using visual studio code as my IDE and i will provide a link to
download it. It is 100% free and it has lot of plugins and those
plugins will help you to code fast and easily. First of all, we will
download and install python 3 to our computer. Please follow this
following link to download it.

Download Python 3 – https://www.python.org/downloads/

Since i am using mac os, webpage will show the default download
option as mac os. But you can simply go to “Download” tab and select
your os to download.

Remember to download python 3 version instead of python 2. Because
both versions have some difference in it’s syntaxes. In this tutorial
series we are using python 3. So install the downloaded package as you
install any other package. After that we need to verify whether python
installed correctly or not. To verify this you need to open a terminal (
in windows, CMD ) and type below code.

python --version

After that you will get your python version. Version number should be
something starting with 3. ( Example : Python 3.6.1 ). It depend on the
version you have download. After that you are good to go with your
first python lesson. Close your terminal or cmd and open your IDE. I am
going to you visual studio code and ill put the download link below.
first of all , you have to install python plugin to vs code (visual
studio code).

Download visual studio code – https://code.visualstudio.com/download

Visual studio code is a very good and light weight IDE and it is only
30mb – 50mb . If you have sublime text, atom or pycharm, you can use it
for this series. VS code can use with windows, Linux or Mac os.

Lets write our first code in python 3. We are going to output a
single text using python. Before that we need to install python plugin
to VS code. Please follow steps from below image.

Now we are ready to write our first code in python 3. To output
something using python we need to use “Print”. As an example we are
going to output “Hello World” text using python.

print ("Hello World!")

Now you need to save the file as a python file. Goto File -> Save
as -> give a file name and put the extension as .py in the end. Look
at the below example image.

now open your terminal or CMD and navigate to the place you saved the
python file. In my case Desktop. After that write below code and you
will get your output as “Hello world”.

//python filename.py 
//my file name is, hello.py
 //So i am going to type it as below 
python hello.py

This is end of the first lesson and we will talk about user inputs
and variables in our next lesson. Please comment under if you have any
problem about this lesson. Feel free to go through with other languages
and lessons written by other programmers in this website. See you with
my next lesson.

One Reply to “Python 3 – Lesson 01 ( Installing python 3 and writing your first code )”

Leave a Reply

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