1. Create a game
I bet you never considered creating a game with Python. But why not? There are awesome libraries that will help you develop games. So let’s help your kids, your partner, or your colleagues get through this crisis with a fun game!
Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries. Here are a few tutorials you can try:
- Making Games with Python & Pygame
- Game development with Pygame
- The official getting started guide (note: as of writing, the site is down, so I linked to a “Wayback machine” version instead)
Panda 3D is a game engine that includes graphics, audio, I/O, collision detection, and other abilities relevant to creating 3D games. Its core is written in C++, so it’s very fast. Lucky for us, we can use the library from Python!
Panda3D has been used to create commercial games as well as some open-source ones. If you always wanted to dive into 3D game programming, this is the time. Start with the official manual.
2. Build a website
This one is a little less original, sure, but it is an essential skill to have! Several frameworks help you build a Python-based website. One of the most well-known is Django. It’s very extensive and can be used to create complex websites. You can start with the official tutorial. It’s excellent.
Another option is Flask. It’s more lightweight and easier to start with while offering enough to create a relatively simple website.
Once you’ve got the basics, here are some ideas to try:
- Your own blog
- A simple online shop
- A shopping list
- A database of jokes or inspirational quotes
3. Create a GUI with Tkinter
Python has a powerful base library to create GUI applications. Many people, including me, use Python mostly for scripting and for backend code. But there are actually quite a few Python GUI applications too!
One thing to note is that
tkinter has been around for a while. Many tutorials you’ll find are written for Python 2. You can quickly recognize these tutorials because they use Tkinter (with capital T), like this:
# don't follow tutorials that start with:
While more recent tutorial will use the new, lower-case library name:
# Look for this instead:
A nice tutorial to get you started can be found here.
Here are a few ideas you can build once you mastered the basics:
- A To-Do application
- A notes application
- A calculator
- A weather app (see tip #5 as well)
4. Build a jokes web service
Another useful skill to possess is the ability to create web services using Python. Several frameworks make this task super easy. These are the most recommended ones:
- Falcon is completely focused on creating web APIs. It’s very fast.
- FastAPI is also focused on writing APIs and is one of the fastest API frameworks for Python.
- Flask is a lightweight web framework, which is also suitable for creating services.
You can pick either. An advantage of Flask is that it’s multi-purpose: you can also use it to create websites.
An idea to get you started is to build a web service that serves jokes. For this purpose, I would recommend diving into
sqlite3 as well.
5. Fetch data from the web
Python is ideal for fetching information from the web. Some terrific libraries will do all the grunt work for you. I’ll list my top 3 here.
Requests is a Python HTTP client. It makes web requests really simple. Many people prefer it over the other available options.
To show how easy
requests can be, here’s some example code:
If you want to fetch more than a couple of fixed URLs, you should look into Scrapy. It can help you build a full-fledged web spider that can discover new pages on its own within set limits.
Once you’ve pulled some HTML from a website, you need to parse it to get what you actually need. Beautiful Soup is a Python library for pulling data out of HTML and XML files. It is mighty powerful and can handle all kinds of HTML, even if it’s broken.
6. Explore some cool tricks and libraries
If you don’t feel like building something yourself right now, you can explore some cool Python tricks and libraries instead:
30 Python Language Tricks That Will Make You a Better Coder
If you think you mastered the language, you’ve got to read this
That’s it — thanks for reading, and happy coding!