5 Cool Things You Can Do with Python

default image

Hey there! Python is an amazing programming language that I‘m super excited to talk to you about today. As a data analyst and AI expert, I work with Python on a daily basis and want to share my geeky passion about why it‘s so useful across many domains.

Whether you‘re new to coding or an experienced developer, Python is a great language to have in your toolbelt. With its simple syntax, active community, and versatility, the possibilities are endless!

In this post, I‘ll dive deeper into 5 cool areas where Python shines and equip you with plenty of tools, statistics, and code snippets to see Python‘s power in action. Let‘s get started!


Python has exploded in popularity in recent years, and for good reason. According to Stack Overflow‘s 2020 survey of over 65,000 developers, Python is the 2nd most loved language.

As a fellow Python enthusiast, I can certainly see why! Here are some of the key reasons why Python is so widely adopted:

  • Versatile: You can use Python for everything from simple scripting to large enterprise applications. Some major areas where Python excels include web development, data analysis, AI, DevOps, and scientific computing.

  • Readability: Python code is designed to be readable and intuitive, using indentation instead of brackets. This makes it great for beginners compared to languages like Perl that are cryptic.

  • Ecosystem: The Python Package Index (PyPI) contains over 200,000 packages covering every use case imaginable. Plus tons of high-quality documentation and tutorials are available online.

  • Productivity: Python‘s high-level dynamic typing and concise syntax mean you can achieve more in fewer lines of code compared to verbose languages like Java or C++. This makes you more productive.

According to a Goldman Sachs report, Python is their #1 programming language and used by 1/3rd of their employees! Its versatility and large talent pool make it a strategic choice for many companies.

Now, let‘s see some cool things you can build with Python! I‘ll deep dive into 5 major domains with plenty of code snippets and resources for you to explore further.

1. Web Development

Python is a very popular choice for web application development thanks to its powerful frameworks like Django and Flask.

Some statistics on Python for web dev:

  • As per the Django homepage, Instagram, Mozilla, Pinterest, and Spotify all use Django as the foundation for their web apps.

  • According to the Stack Overflow Developer Survey 2022:

    • Django is the 4th most popular web framework overall
    • Django is the most loved web framework with 75.1% of developers expressing interest in continuing to use it
  • Flask has over 67,000 GitHub stars and is the most starred Python web framework project showing its popularity.

Some advantages of using Python for web development that contribute to its popularity:

  • Increased productivity thanks to its high-level concise syntax and dynamic typing
  • Rich ecosystem of 3rd party packages for tasks like API access, database integration, performance monitoring, and more
  • Full-stack capabilities to build the frontend, backend, and everything in between
  • Ability to scale complex apps thanks to Python‘s performance and asynchronous frameworks like asyncio
  • Community support through documentation and the large Python talent pool

Here‘s a simple example Flask application:

from flask import Flask  

app = Flask(__name__)

def home():
  return "Hello, welcome to my web app!"

if __name__ == "__main__":

This shows the basic routing and a development server to display "Hello World" at the / path. From this foundation, you can start building a complex web app.

To summarize, Python offers the perfect blend of rapid development along with the ability to create large scalable web apps. The statistics above showcase its popularity among many top companies.

Check out The Flask Mega-Tutorial and MDN‘s Django Tutorial when you‘re ready to dive deeper into Python web development!

2. Automation

Another area where Python shines is scripting and automation. Python has a vast standard library and external packages to automate everything from file operations to browser testing.

Some examples of popular automation tasks with Python:

  • System administration (updating configurations, servers, etc)
  • Batch processing data (ETL, reports, etc)
  • Web scraping (extracting data from websites)
  • Browser testing and QA automation
  • Scheduling (cron jobs, social media posting, etc)

Python is one of the top choices for automation because:

  • It runs on all major platforms like Windows, Linux, and macOS
  • Easy to write and read automation scripts compared to bash or Perl
  • Access to native system APIs and a plethora of automation libraries
  • Lots of documentation and Q&A support for Python online

According to Stack Overflow‘s 2022 survey, Python is the 2nd most popular language for DevOps and site reliability engineering – automation heavy roles!

Let‘s look at a simple example:

import os
from datetime import datetime 

log_file = f"logs_{‘%Y%m%d‘)}.txt"

print(f"Script started at {}")

print("Listing contents of current directory:\n") 

for filename in os.listdir(‘.‘):
  print(f"- {filename}")

with open(log_file, ‘w‘) as f:
  f.write("Script execution succeeded") 

This script shows how easily you can work with files, directories, dates, and text output. By expanding on these building blocks, you can automate virtually any repetitive task on your computer!

For more examples, check out Automate the Boring Stuff which is the definitive guide to Python automation.

3. Game Development

For game development, Python provides great frameworks like Pygame, Panda3D, Pyglet, and PySFML. These make tasks like windowing, graphics, audio, user input, physics, and 3D scenes easy so you can focus on game logic.

Some statistics on Python for game dev:

  • According to a Kivy survey, 25.7% of Python game developers use Pygame and 15.7% use Kivy.

  • Civilization IV, EVE Online, Battlefield 2, and Disney‘s Toontown Online are all games built with Python.

  • The Pygame and Panda3D game engines have been used to make over 1000 games showing Python‘s versatility.

Some benefits of using Python for games:

  • Rapid prototyping with its easy syntax and dynamic types
  • Cross-platform support on desktop, web, mobile, and gaming consoles
  • Great for indie developers thanks to its accessibility
  • Support for 3D graphics and physics engines
  • Can integrate with other languages like C++ for performance

While performance critical parts can be optimized in a compiled language like C, Python is great for the majority of game code.

Here is a simple Pong clone in Pygame:

import pygame

screen = pygame.display.set_mode((600, 400))
paddle = pygame.Rect(50, 200, 20, 60)
ball = pygame.Rect(100, 100, 15, 15)

while True:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:

  keys = pygame.key.get_pressed()  
  if keys[pygame.K_UP]:
    paddle.y -= 3
  if keys[pygame.K_DOWN]:  
    paddle.y += 3

  ball.x += 5  
  if paddle.collidepoint(ball.x, ball.y):
    ball.dx = -ball.dx

  pygame.draw.rect(screen, (255,255,255), paddle) 
  pygame.draw.ellipse(screen, (255,255,255), ball)

While basic, this shows how Pygame provides the building blocks like graphics, input, geometry, and collision detection so you can focus on the gameplay logic.

To learn more, check out Invent with Python which provides free books on making games with Pygame and Pyglet. The Python game dev community is also very active and helpful!

4. Data Analysis

One of Python‘s most popular uses today is data analysis and visualization. Libraries like NumPy, Pandas, Matplotlib, and Seaborn make data exploration intuitive.

Some interesting stats:

Why Python has become the "lingua franca" for data analysis:

  • Huge ecosystem of data libs like Pandas, NumPy, SciPy, StatsModels, and scikit-learn
  • Interactive notebooks using Jupyter for mixing code, visuals, and text
  • Widely used programming language makes it easy to integrate into production apps
  • Very expressive language with vectorized operations and broadcasting
  • Great for ad hoc analysis and exploration without compile steps

Here is a simple example loading a dataset and generating some plots:

import pandas as pd
from matplotlib import pyplot as plt

data = pd.read_csv(‘employees.csv‘)  

plt.hist(data[‘Age‘], bins=20)
plt.scatter(data[‘Experience‘], data[‘Salary‘])

This concise code loads the data, creates a histogram of employee ages, and a scatterplot between experience and salary. Python‘s visualization libraries like Matplotlib allow understanding data easily.

To go further, check out:

5. Machine Learning

Last but certainly not least, Python plays a huge role in machine learning and AI. It offers all the tools needed to build models for tasks like classification, prediction, clustering, image recognition, and more.

Some interesting facts about Python for ML:

  • According to KDnuggets, Python was used by 56% of data professionals for machine learning compared to 33% for R.

  • Python is the 2nd most loved language among machine learning developers after C, based on Stack Overflow‘s survey.

  • Google‘s TensorFlow and Facebook‘s PyTorch – the top 2 deep learning frameworks – are both Python-first and have huge adoption.

Why Python works so well for ML tasks:

  • Huge ecosystem of ML libraries like scikit-learn, Pandas, NumPy, TensorFlow, PyTorch, and Keras
  • Dynamic typing and vectorized operations critical for model experimentation
  • Awesome support for GPU acceleration
  • Great tools like Jupyter notebooks for iterative modeling
  • Vibrant community of machine learning researchers and engineers

Here‘s a quick example training a simple neural network with Keras:

from keras.models import Sequential
from keras.layers import Dense  
import numpy as np

# Generate dummy data
x_train = np.random.random((1000, 20))
y_train = np.random.randint(2, size=(1000, 1))

# Build and compile model  
model = Sequential()
model.add(Dense(64, input_dim=20, activation=‘relu‘))
model.add(Dense(1, activation=‘sigmoid‘))  
model.compile(loss=‘binary_crossentropy‘, optimizer=‘adam‘, metrics=[‘accuracy‘])

# Train model, y_train, epochs=5, batch_size=32) 

# Evaluate on new data  
x_test, y_test = get_new_data() 
model.evaluate(x_test, y_test)

This shows just how productive Python + Keras are for building neural networks compared to lower-level alternatives. With a few lines of code, you can start training models!

For a more in-depth introduction, I highly recommend the courses which are free and use Python+PyTorch. The TensorFlow docs also have great end-to-end ML guides.

The Python machine learning community is extremely active with tons of tutorials and projects available to learn from.


As you can see, Python is an incredibly versatile language that excels in domains from web apps to cutting-edge AI.

While I‘ve highlighted 5 major uses of Python here, the possibilities are truly endless. Thanks to its vibrant ecosystem and community, you‘ll find high-quality Python libraries and support for virtually any programming task imaginable.

I hope this post showed you why Python is such a cool programming language that‘s loved by beginners and experts alike. The best way to experience Python is to just start building! Pick an area you‘re interested in and search for some "Python for X" tutorials to get your feet wet.

Let me know if you have any other questions. I‘m always happy to chat more about Python!

Happy coding!

Written by