And why not, you can build from simple maintenance scripts to complex machine learning application. There are many cool things you can do with Python, which you’ll love to learn.

Introduction

Python is a very popular language among developers. It is easy and fun to write scripts to automate and build stuff. Some of the common use cases are:

Creating bots Scraping websites Machine learning, data visualization, and analysis Web Development with frameworks like Django and Flask Game development with Pygame Mobile apps with frameworks like Kivy

In this article, I’ll try to cover multiple domains with examples and show you some of the fun stuff you can do with Python. In case you don’t know python, I’ll recommend learning it! Let’s get started!

For Web Development

Python has very good support for web development with its frameworks like Django, Flask, and others. It can be used to build server-side web applications and can be integrated with any frontend. Generally, developers use JavaScript in frontend and python for supporting server-side operations. Python is not used directly in browsers. Django is one of the most popular web frameworks in python. These frameworks provide a package where you have a defined structure, supports database interactions with ease; all this is set up with a minimal setup command. If you want something minimal to start with – I’ll recommend Flask! Apart from these, Python has a large number of libraries for web development. Some popular ones are –

Requests Pillow PyMongo

Some resources to get started with web development in Python –

Educative Blog Web app from scratch

Example – Access to the computer file system from mobile

You can access your file system by running a file server on your machine. Go to the desired directory that you want to access and run the following command – This starts a file server that can be accessed on the same network. To access your files on mobile, simply connect to the same network(wifi or use the phone’s hotspot on a laptop). Now in your phone browser open – :port Check your IP by running – ifconfig. Check your local IP (should start with 192.168….) Suppose your IP is – 192.168.43.155 and you use the default port. Then, you should open – 192.168.43.155:8000 on mobile. You’ll see current directory 🙂

Automation and Scripting

If you are an engineer, you probably will be lazy and want to automate almost everything you can, right? No worries, python got you covered. There are a ton of things that you can automate with as little as 4-5 lines of code.  From setting cron jobs and reminders to downloading your favorite youtube videos, you can do it all with a couple of lines in python. Some awesome scripts and packages you can start using –

A-Z of useful python tricks Awesome Python scripts Files deletion HTTP/2 test

Example – Convert CSV to JSON

You can convert the CSV file to JSON with just 1 command in python! Try it now – Replace with your filename.csv, and you will get a JSON output! Easy, right?

Building Games

Python supports developing games. Its Pygame library is highly useful. It supports art, music, sound, video, and multimedia projects to be built with it. You can even make cross-platform games using Kivy, which runs on Windows, Mac, Linux, Android, and iOS.

Resources to learn

Freecodecamp tutorials Raywenderlich tutorial

Example – Hangman in Terminal

Here is a simple python program which lets you play hangman game in the terminal. Code can be shortened a lot, and I’ll leave that as an exercise to you! The output would look something like –

Web Scraping

You see a lot of data every day across multiple sites. Think how cool it would be if you can access that data easily; that is what web scraping is, and python makes it even easier with its amazing support and libraries. Data on the web is unstructured, and python provides an easy way to parse and consume this data and even do further analysis and operations. Some popular scraping libraries are:

Beautiful Soup Scrapy

Let me show you an example on how you can scrape currency values from a website – x-rates.com

Example – Get currency value compared to USD

Let’s use scraping in python to fetch currency values – This returns how much 1 USD equals in other currencies.

Data Science and Machine Learning

DS and ML are the most trendy topics these days. These technologies are the future of computer science. Python is well suited for data manipulation, analysis, and implementing complex algorithms. Data parsing and visualization are usually simple functions or a few lines of code with python libraries like NumPy, scipy, scikit-learn, etc. Python can be used in data-intensive and machine learning application using a lot of popular libraries like –

NumPy Pandas Matplotlib Seaborn

There are a lot of deep learning tools that support python. Some popular libraries and frameworks are –

TensorFlow PyTorch Keras

One of the other reasons python is used is even complex machine learning models can be achieved with 20-40 lines of code. Check this tutorial on how easily visualizations can be done in python.

Conclusion

The tutorial discussed various domains in which python can be used. Here, I present a few of the cool and simple examples for the purpose of the demonstration, but there are a lot more awesome applications and tools you can build with Python. I hope you learned something new! Keep exploring. Keep learning!

5 Cool things You can do with Python - 335 Cool things You can do with Python - 85 Cool things You can do with Python - 215 Cool things You can do with Python - 335 Cool things You can do with Python - 175 Cool things You can do with Python - 605 Cool things You can do with Python - 805 Cool things You can do with Python - 85