What is python used for: Beginner’s Guide to python

Prerequisites

If you’re looking forward to learning python, chances are that you will find this post quite useful. Here you will learn about Python. What it is used for? where to learn it?

To know more about any language, you need to know a little bit about its history. by knowing its history you will know a lot about language main focus and it’s development directions.

Python is one of the most popular programming languages used according to the StackOverflow 2019 survey. In this article, we will know more about

  • The History of python
  • How long does it take to learn
  • The main usage of python
  • Where to learn python for free

Programming language popularity chart according to StackOverflow 2019 survey

History of python

Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991. Guido’s goal of python is to be open-source and interactive programming language. He wanted to encourage other developers to use it. Python is based on C Language, which helps python in performance. CPython’s goal is to translate a Python script into C and make direct C-level API calls into the interpreter. Python’s code readability makes it useful for long term projects. It is a good choice for different companies. And beyond the usage of python in large business projects, developers started to use python for side projects. Now you know the main goal of python. Python focus on readability, performance. Python supports different operating systems. Let’s start looking at its main usage.

The main usage of python

The support of multiple programming paradigms object-oriented and functional programming and the huge community behind are helping the language to be adapted in different development fields. Let’s talk more about Python’s popular usage.

Web development

In Web development there are a lot of programming languages options.  Python is widly adoabted in web development with frameworks like Django, Flask and Pyramid. Or with scrapping tools  like scrappy, BeautifulSoup4 that fetch the data from different websites.

Django is the biggest python web framework. It’s an MVC (model-view-controller) framework that encourages rapid development. it provides well-structured files with standard architecture. Django gives you out of the box project:

  • Scalable architecture with a lot of customizations.
  • A settings module that contains project configurations.
  • ORM (object-relational mapper) that translates your python code into SQL.
  • Admin portal with a user management system.
  • Template engine for HTML rendering.
  • Built-in form validation.
  • Vulnerabilities prevention like (SQL injection, cross-site scripting, clickjacking, and password management )

You can know more about Django in our introduction to Django.

Flask is a microframework, it called that because it doesn’t require particular tools or libraries to be installed. It has no default database or form validation, you have full control over the project architecture. You can add the tools according to your needs. Flask is a quick solution for big projects or micro-services based projects. This does not mean that Flask is not a good option for scalable projects. Flask meant to be an easy choice for

  • Projects that need detailed customization
  • Microservices systems.
  • Creating web applications quickly with the minimum amount of configurations.

Note: We did a full comparison between Django and other frameworks in the previous article. Python usage isn’t just for building web applications only, other fields like machine learning and data science.

Machine Learning and Data Science

Python is very good at resources management (RAM, CPU, and GPU). Data scientist & Machine learning engineers are using it With libraries like:

  • Tensor flow, an end to end python platform for machine learning.  it handles complex computations. it used in NLP, voice recognition with an out of the box user-friendly responses.
  • Pytorch,  A production-ready machine learning library. It takes advantage of machine CPU and GPU to enable applications to accelerate the calculations
  • NumPy, Python’s most popular library for complex mathematical operations. It has a lot of linear algebra equations like Fourier transformation.

Data science and Machine learning are heavily used recently in academic researches and in companies. You need a good Mathematical background and you’re ready to start learning it.

Automation scripts

DevOps and security engineers are using it to write automation scripts to help them in their daily work. check our article about using boto with python for access AWS services

You can use it in almost all kinds of applications except mobile and gaming it’s not good at it.

How long does it take to learn?

Apparently, the time of learning a new language isn’t fixed for everyone. It was designed to be human-readable like English. we can say that it could take about 2 weeks to learn it’s basics and start using it.

Here is an example of python syntax

# define variables
language = "english"

# check type the type
type(language)  # str

# python boolean
is_readable = True

# List Data structure
numbers = [1, 2, 3, 4, 5]

# conditional statment
If language == "english":
   print("Welcome to english language")
else:
   print("Invalid language")

# iteration and for loop
for num in numbers:
    print("current number is : ", num)

# we can use ptyhon funtions to isolate logic
def get_number_type(number):
    if number % 2 == 0:
       return "Even number"
    else:
       return "Odd number"

# calling function

number_type = get_number_type(2)
print(number_type)
# Output : Even number

number_type = get_number_type(3)
print(number_type)
# Output : Odd number

The above code was an example of easy to read Python code. that’s why Python is easy to learn. check out tips for clean python code.

Where to learn python for free?

There are tons of resources to learn it for free, we will list the best learning resources.

  • Documentation docs tutorial
  • Udacity Course Introduction to python programming
  • Coursera Specialization Python for everybody
  • Tutorialspoint tutorial
  • W3Schools tutorial
  • Sololearn course

Conclusion

From the above explanation, it must be clear that you can use python with different applications. There is a wide usage of python in different industries and fields. it’s compatible with all operating systems. It is a good start if you want to start your career with programming.  Python is a very useful tool to use as a mathematician who wants a couple of scripts in his daily work. And if you are looking for scalable web application python is a good choice too.