Python 3 Tutorial for Everyone Chapter 1: Welcome | Setup | Overview


Recently I started a Python 3 Video tutorial series for beginner to intermediate for Bangla language speaking people. Now I have started to write a series tutorial about Python 3 for everyone. In this post, I will discuss how to setup Python 3, how to run hello world program and some overview.

Python is an interpreted high level language for general purpose programming. It was initiated by Guido Van Rossum and first released in 1991. It is a duck type language, easy to understand and now very popular in both academic and professional world.

Using Python one can write simple script to web app development. Also in machine learning or in deep learning Python is very popular as it has some outstanding open source libraries.

We have a video tutorial for this chapter for Bangla speaking people:

Setup

Normally in MacOS and Linux Python 2.7+ is commonly distributed with the OS, but in this series tutorial we will work on Python 3.

To install Python 3, please visit https://www.python.org/downloads/ and download the latest 3.6+ version for your macOS or linux or windows. Then install it in your machine.

Python 3 has a built-in IDLE – Interactive Development Environment installed automatically. If you run it you can see the following window. At the top left you can see the version number installed, here we are seeing Python 3.7

Now write a simple code, and press enter. You’ll see Hello World is printed under the code. Because this is interactive, we can see output immediately after the code interpreted.


print ("Hello World")

 

For very simple testing, IDLE is okay. We can also use Python 3 in terminal. If you open your terminal and type just

python

You’ll see python interactive shell is opened in terminal if it installed successfully. But by default in macOS it is version 2.7+

To open Python 3 shell, write

python3

And now you will see Python 3.7+ shell is running. We can also write code and test here like we did before in IDLE

But we prefer writing code in text editor and then run in terminal. To write Python 3 code we prefer Atom text editor. If you want you can download and install it from here. But you can use any text editor other than Atom

Here you’re seeing an Atom window.

 

class X:
    def show(self, name):
        print("My name is: " + name)
        
x = X()
x.show("Ahsan")

Now Open terminal and go to your code directory where you saved the file named helloworld.py, now write in terminal

python3 helloworld.py

This is how we run normal script in terminal. You can see the output printed after the commands:

My name is: Ahsan

In our series tutorial we will mostly follow this way. But there is another IDE named PyCharm by JetBrains company which is also very popular. But in my opinion, I think that best suited for big project or web app development.

To install PyCharm, visit the site, download the community version which is free and install. Then open the program, you’ll see the following window, now click File->New Project… Then give a name and create.

 

After the HelloWorld project created, create a new file helloworld.py within HelloWorld project and write the following code:


class X:
    def show(self, name):
        print("My name is: " + name)
        
x = X()
x.show("Ahsan")

Now run the project, a window will be shown to select project, after you select it you’ll see the following output “Hello World” at the bottom.

There is some other way, to install python in a system, but here we have shown the common ways. In next chapters, we will discuss more about the language features.

Thank you, for reading my post.

mahmud ahsan

Computer programmer and hobbyist photographer from Bangladesh, lives in Malaysia. My [Github | Business | Twitter | Linkedin | Youtube | Instagram | 500px]

You may also like

LEAVE A COMMENT