DEV Community

Cover image for 5 Strange Things You Can Do With Python
Elliot Brenya sarfo
Elliot Brenya sarfo

Posted on

5 Strange Things You Can Do With Python

If you're thinking of learning Python or if you started learning it recently, you might be wondering what can I use python for exactly? Well, that's actually a tricky question to answer because there are so many applications of Python, but over time I've seen that there are three main popular applications for Python which are; web development, data science including machine learning, data analysis and data visualization and scripting.

Image description
I am going to elaborate on each list and also going to mention game development, embedded applications, and desktop applications.

1.Data analysis, manipulation and visualization.

2.Automatically detects what’s in images

  1. Create games with Python

  2. Building robotics applications

  3. Automating your daily routine tasks

First of all, Web frameworks like Django and Flask which are based on Python have recently become very popular for web development. These web frameworks basically help you create server-side code. That's of course the code that runs on your server.

But wait, you might say why do I need a web framework in the first place? Well, that's because using a web framework makes it easier to build a common back end logic, so this includes things like mapping different URLs to different chunks of Python code dealing with databases and generating HTML files users see on their browsers and which Python web frameworks should you use?

If you're just getting started, well, Django and flask are two of the most popular Python web frameworks, so I'd recommend using either one. If you're just getting started now, Flask is a smaller framework and it has fewer components built into the framework itself and that actually makes Flask a little bit simpler to learn than Django and a little bit more flexible.

On the other hand, Django has more components built into the framework itself. For example, it has a very specific way to deal with databases, but with Flask you need to choose what kind of database you want to use and how you want to interact with that database exactly? So I think Flask is a better choice if you want more control over what your code is going to look like exactly and Django, it's probably a better choice if you are just more focused on building a straightforward application like a news site or blog. Let's go to the next topic, Machine learning.

Let's first quickly review what machine learning is and explain what is machine learning. I think the best way to do that would be to give you a simple example. So let's say you want to develop a program that recognizes a picture. So for example, given picture of dog, you want your program to recognize that it's a dog, and given this other picture, you want your program to recognize that it's a table.

Given this problem, you might say, well, maybe we can just write some code to do that. So for example, if there are a lot of light brown pixels in the picture. Then maybe we can say that it's a dog, and if there are a lot of know straight edges. Let's say you figure out a way to detect edges in a picture and if there are a lot of straight edges in a picture, then it's a table instead of a dog but this kind of approach gets tricky pretty quickly, and you know the reason is. For example, if what if there's a white dog in the picture with no brown hair? Or what if there is a table in the picture, but it only shows the round parts of the table? And that's where machine learning comes in. Machine learning typically implements an algorithm that automatically detects a pattern in the given input.

So in this example you can give, say, 1000 pictures of a dog and 1000 pictures of a table to a machine learning algorithm and say you know these are the pictures of a dog and these are pictures of a table and it will learn the difference between the two. So when you give it a new picture of either a dog or a table. You will be able to recognize which one it is now. You can use the same idea to apply machine learning to things like recommendation systems. YouTube, Amazon and Netflix, and face recognition and voice recognition among other applications. Popular machine learning algorithms you might have heard about include neural networks, deep learning, support vector machines, and random forests.

You can actually use any of these algorithms to solve the picture of a billing problem. I explained earlier. Now there are a few popular machine learning libraries and frameworks for Python two of the most popular ones are called Scikit Learn and TensorFlow Scikit learn comes with some of the most popular machine learning algorithms built in. You know, I mentioned some of them earlier and tensor flow is more of a low level library that allows you to build custom machine learning algorithms. So if you're just getting started with a machine learning project.

I recommend that you first start with Scikit learn and then if you start running into, you know efficiency issues, then I'd consider looking into tensor flow and how should you go about learning machine learning.

I think learning the fundamentals of statistics will be really helpful as well. For that, I'd recommend websites like Khan Academy and Coursera. Let's now go to the next topic, which is scripting.

Well. First of all, what is scripting? Scripting usually refers to writing small programs that are designed to automate simple tasks. Python is also a good language for this kind of task and Python is 34. This kind of task, mainly because it has relatively simple syntax and it's easy to learn but it's also quick to you know, write something with it and test it. So these are the three main popular applications of Python. But you might say what about game development? Well, you could use this library called Pygame to develop games, but it's not the most popular gaming engine you could use it to build a hobby project, or you know a personal project, but I personally wouldn't choose it. If you're serious about game development.

If you're serious about game development, I'd rather you know, pick something like unity with C sharp, which is one of the most popular game development engines out there and what about desktop applications? You could make one using Python.

Discussion (0)