What is Python, Uses, Installing and Why Learn Python

Starting from this Python tutorial, you’re going to learn everything you need to get started with Python programming, and today, we’re discussing what Python is, how to install python, uses and why you should learn Python.

Python Tutorial - Python Course for Beginners #1

Python is the world’s fastest growing and most popular programming language not just amongst software developers, but also amongst mathematicians, data analysts, scientist, accountants, network engineers and even kids. In fact, it’s the ideal programming language to learn first.

But what makes Python so special?

Here are six reasons that makes Python so special:

With Python, you can solve complex problems in less time with fewer lines of code than many other languages. That’s why huge companies like Google, Spotify, Dropbox and Facebook have embraced this beautiful and Powerful language.

Now here’s an example:

Let’s say we want to extract the first three characters of the text Hello World.

This is the code we would have to write in C# – str.Substring(0, 3)
This is how we would do this in JavaScript – str.substring(0, 3)
And here’s how we would do it in Python – str[0:3]

See how clean and simple the language is and that’s just the beginning.

What is Python, uses, and why you should learn Python

Python is a multi-purpose programming language and you can use it for a wide range of jobs such as data analysis, artificial intelligence (AI) and machine learning, writing automation script, building web, mobile and desktop applications as well as software testing or even hacking. So if you want a high-paying long-lasting career in any of these areas, especially AI and machine learning Python is the language to put those opportunities at your fingertips.

In fact, according to indeed.com, the average salary of a Python developer in the US was over a hundred and fifteen thousand dollars in March 2018, and here are four more reasons that make Python the most desirable language.

  1. Python is a high-level languag, So you don’t have to worry about complex tasks such as memory management as you do in C++.
  2. It’s cross platform, which means we can build and run Python apps on Windows Mac and Linux.
  3. It has a huge community. So whenever you get stuck, there’s someone out there to have
  4. and it has a large ecosystem of libraries Frameworks and tools
READ ALSO:  Secret's To Discover Your True Passion.

Whatever you want to do, it is likely that someone else has done it before, because Python has been around for over 20 years.

Versions of Python

There are two versions of Python namely:

  • Python 2, which is the Legacy version of Python and it’s going to be supported until year 2020
  • Python 3, which is Python for the future.

In this tutorial, we’re going to Learn Python 3.

How to Install Python

Alright now we’re ready to download and install Python. The first thing you need to do is to head over to python.org. On this page, under the Downloads Menu (image below), you can see the latest version of python. Currently, The latest version is 3.7, chances are in the future when you’re reading this tutorial, there’s a newer version available. Don’t worry all the materials in this course will continue to apply with the future versions of python.

Downloading Python

So go ahead and download the latest version of python and then run it.

If you’re on Windows, you’re going to see a checkbox saying “Add Python to PATH.” This is very important, make sure to tick it. Otherwise, you’re not going to be able to follow the tutorial. Note that Mac in Linux by default comes with an older version of Python that is Version 2. So now go ahead and click the “install Now” button then you wait for the process to complete.

How to install Python

Python Interpreter

Python Interpreter picture

So this environment you see here is what we call python interpreter, which is basically a program that execute python code. We can type our python code in a file and give it to the interpreter or we can type our code directly in the interactive shell.

In programming, an expression is a piece of code that produces a value, so we can write an expression like 2 + 2 and hit the enter key, we get 4.

Expression in value

when we add 2 + 2, we get a value, that is why we refer to this piece of code as an expression.

READ ALSO:  Best Way To Confront A Bully And End Your Fear.

Let’s try a different kind of expression. Let’s see if 2 is greater than 1.

Expression in Boolean

We get “True” which is an example of a Boolean value. You’re going to learn about these Boolean values in the next section.

Now, what if we type “2 > 5” then click the Enter key, we get false. So in programming we have True and False which are similar to yes and no in English.

Now what if we type 2 > and we don’t have a second value. Just press enter.

Syntax Error for 2 greater

We have a syntax error. In programming, syntax means grammar, just like we have the concept of grammar in the languages that we speak, We have the exact same concept in programming. If we write a sentence that is not grammatically correct, chances are some people may not understand that sentence.

So in this example, we have this expression which is incomplete. It doesn’t have the right grammar or syntax. That is why python interpreter is complaining by returning an error.

So this interactive shell is a great way to quickly experiment with a bit of python code, but that’s not how we build real world applications to do that we need a code editor.

Python Code Editor

When it comes to typing Python code, you have two options. You can use a code editor or an IDE, which is short for integrated development environment.

An IDE is basically a code editor with some fancy features like Auto completion, which means as you type code this feature helps you complete your code, so you don’t have to type every character by heart. It’s a productivity boosting. It also gives you additional features like debugging, which means finding and fixing bugs in your programs, testing and so on.

For both code editors and IDEs, there’s so many options out there but the most popular code editors are VSCodeAtom and Sublime. You can use the code editor that you prefer. In terms of the IDEs, again, there are so many options out there but the most popular one is PyCharm. In this tutorial, I’m going to use VSCode (Visual Studio Code) because that’s my favorite code editor.

Later in this tutorial, I will show you how to install a plug-in or an extension that would convert VSCode to a powerful IDE. So, before going any further, head over to code.visualstudio.com and download the latest version of the VSCode.

READ ALSO:  Best Hacks To Use Your Time Effectively.

Python Extension

I’m going to show you how to convert VSCode to a powerful IDE by using an extension called python, with this extension or plugin, we get a number of features such as

  • linting, which basically means analyzing our code for potential errors.
  • We also get debugging which involves finding and fixing errors we’ll look at this later.
  • Also, autocompletion which basically helps us write code faster, so we don’t have to type every character.
  • We get code formatting which is all about making our code clean and readable just like how we format our articles, newspapers, books, to make them clean and readable.
  • We get unit testing which involves writing a bunch of tests for our code. We can run these tests in an automated fashion to make sure our code is behaving correctly.
  • And finally we get code Snippets which are reusable code blocks that we can quickly generate so we don’t have to type them all by heart.

Don’t worry about memorizing any of these, as we go through this tutorial, you’re going to learn about this features.

Python Extensions tab

Now in VSCode, on the left side. Click the extension icon by the left. This opens the extensions tab. So these are the extensions that we can install in VSCode to bring in additional functionality. you’ll see under the recommended tab, python extension. if you don’t see it, use the search bar at the top and search for Python.

Install Python

Now go ahead and click the install button and then you will have to reload VSCode after python is successfully installed.

Reload Python

After VSCode is installed, you should see a message at the bottom right corner saying “linter pylint is not installed”. So as I told you before linting is about finding potential errors in our code linter is a program or a tool that analyzes our code and finds is potential problems.

Now for python, there’s several linters out there and pylint is one of the most popular ones that this python extension uses by default. So we need to go ahead and install pilot as well.

Note: Make sure you chose the right Python version which is Python 3.x at the bottom left corner. So these changes are python environment to Python 3.x and then we can install pylint.

Leave a Comment