If you are thinking of learning Python or have recently started learning it, you may be asking yourself: What exactly is Python used for? This is a complicated question because the applications of Python are very diverse. But over time, 3 main uses of Python have emerged:

  • Web Development
  • Data science: including machine learning, data analysis, and information visualization
  • Scriptwriting

Web Development

Web frameworks based on Python have recently become very popular for web development. These web frameworks help you create server-side code in Python. This is a code that runs on your server.

Why do we need a web framework?

Because the web framework helps to create “site logic”. This involves mapping various URLs to address databases and generating HTML files that users view in their browsers.

Which Python framework should we use?

Django and Flask are two of the most popular Python web frameworks. If you are just starting, we recommend using one of these two.

What is the difference between Django and Flask?

Flask provides simplicity and flexibility. (It allows you to decide how to implement things.)

Django provides an all-in-one experience: you get an admin panel, database interfaces, an ORM, and a directory structure for your apps and projects.

If you’re focused on experience and learning opportunities, or if you want more control over the components used (which databases you want to use and how you want to interact with them), choose Flask. But if you’re focused on the end product, like when you’re working on a news site, an e-store, or a blog, and you want there to always be a clear way of doing things, choose Django.

In other words, if you’re a beginner, Flask is probably a better choice because it’s less detailed. Also, if you want more customization, Flask is a better choice. On the other hand, if you’re looking to build something directly, Django lets you do it faster.

Data science: including machine learning, data analysis, and information visualization

Before we begin, let’s review what machine learning is. The best way to explain machine learning is to use a simple example. Let’s say you want to build a program that can automatically recognize what’s in an image.

This is where machine learning comes into play.

For example, you can give the machine learning algorithm a thousand images of dogs and a thousand images of benches. Then, it learns the difference between a dog and a bench, and when you present a new image of a dog or a bench, it can tell the difference.

This process is not unlike how a child learns. How does a child learn the difference between a dog and a couch? Probably using a bunch of examples. You don’t tell a child outright, “If something is furry and has light brown hair, it’s probably a dog.” You just say, “It’s a dog. And that is a bench.”

Machine learning algorithms work in almost the same way.

You can apply the same idea to:

Recommender systems (YouTube, Amazon, and Netflix), face recognition, voice recognition

Common machine learning algorithms you may have heard of include:

  • Neural Networks
  • Deep learning
  • Support vector machines
  • Random forests

You can use any of the above algorithms to solve the image labeling problem.

Python for machine learning

There are many popular machine-learning libraries and frameworks for Python. Two of the most popular ones are Scikit-learn and TensorFlow. If you are just starting a machine learning project, I recommend starting with scikit-learn first. But if you are starting something with high productivity, I recommend you to use TensorFlow.

Data analysis and information visualization

To better understand this issue, we use a simple example. Let’s say you work for a company that sells products online. As a data analyst, you can draw a graph that shows how many products men bought compared to women on a given day (say, the weekend). As a data analyst, you may come up with possible explanations for this difference. One possible obvious explanation is that this product is more popular among men. Another possible explanation is that men for some reason are more inclined to buy this product on weekends.

Data analysis and information visualization with Python

One of the most popular libraries for data visualization is Matplotlib.

This is a good library to start with because:

It’s easy to get started

Some other libraries like Seaborn are based on it. Therefore, learning Matplotlib will help you learn other libraries.

Scriptwriting

What is scripting?

Scripting usually refers to writing small programs designed to automate simple tasks. Python is suitable for this type of work because it has a relatively simple composition and is very easy to write. It is also quick to write small programs with it and test them.

What about game development?

You can use a library called PyGame to develop games, but this is not the most common library. You can use it to make a hobby project, but if you are serious about game development, we do not recommend this library. Instead, we recommend Unity, which is one of the most popular game engines. Unity allows you to create games for many platforms, including Mac, Windows, iOS, and Android.

What about desktop apps?

You can use Tkinter, but it doesn’t seem like the best choice. Instead, languages like Java, C#, and C++ are more popular for this.

Note: A simple definition of back-end and front-end codes

Let’s say you want to create an app like Instagram. You must create front-end code for each type of device you want to support. For example:

  • Swift for iOS
  • Java for Android
  • JavaScript for web browsers

Any set of code will run on any type of device/browser. This is the set of code that determines how the layout of the program should be and when the button is clicked, what should change their appearance, and… You also need the ability to store user information and photos, and you should store them on your server (not just on users’ devices).

This is where the back-end code (server-side code) comes in. To do things like keep track of who follows each other, compress photos, suggest pages that match users’ interests, etc.

Simply put, this is the difference between back-end code and front-end code. However, Python is not the only choice for writing back-end code. There are other popular options, including Node.js, which is based on JavaScript.

Leave a Reply

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