Python tutorials

Reading and Writing WAV Files in Python

There’s an abundance of third-party tools and libraries for manipulating and analyzing audio WAV files in Python. At the same time, the language ships with the little-known wave module in its standard library, offering a quick and straightforward way to read and write such files. Knowing Python’s wave module can help you dip your toes into digital audio processing. If topics like audio analysis, sound editing, or music synthesis get you excited, then you’re in for a treat, as you’re […]

Read more

Finding Python Easter Eggs

In this Code Conversation, you’ll follow a chat between Philipp and Bartosz as they go on an Easter egg hunt. Along the way, you’ll: Learn about Easter egg hunt traditions Uncover the first Easter egg in software Explore Easter eggs in Python There won’t be many code examples in this Code Conversation, so you can lean back and join Philipp and Bartosz on their Easter egg hunt. What’s Included: Downloadable Resources:    

Read more

The wrong way to speed up your code with Numba

If your NumPy-based code is too slow, you can sometimes use Numba to speed it up. Numba is a compiled language that uses the same syntax as Python, and it compiles at runtime, so it’s very easy to write. And because it re-implements a large part of the NumPy APIs, it can also easily be used with existing NumPy-based code. However, Numba’s NumPy support can be a trap: it can lead you to missing huge optimization opportunities by sticking to […]

Read more

Build a Python Turtle Game: Space Invaders Clone

In this tutorial, you’ll use Python’s turtle module to build a Space Invaders clone. The game Space Invaders doesn’t need any introduction. The original game was released in 1978 and is one of the most recognized video games of all time. It undeniably defined its own video game genre. In this tutorial, you’ll create a basic clone of this game. The turtle module you’ll use to build the game is part of Python’s standard library, and it enables you to […]

Read more

SQLite and SQLAlchemy in Python: Move Your Data Beyond Flat Files

All programs process data in one form or another, and many need to be able to save and retrieve that data from one invocation to the next. Python, SQLite, and SQLAlchemy give your programs database functionality, allowing you to store data in a single file without the need for a database server. You can achieve similar results using flat files in any number of formats, including CSV, JSON, XML, and even custom formats. Flat files are often human-readable text files—though […]

Read more

Model-View-Controller (MVC) in Python Web Apps: Explained With Lego

If you’re curious about web development, then you’ve likely encountered the abbreviation MVC, which stands for Model-View-Controller. You may know that it’s a common design pattern that’s fundamental to many Python web frameworks and even desktop applications. But what exactly does it mean? If you’ve had a hard time wrapping your head around the concept, then keep on reading. In this tutorial, you’ll: Approach understanding the MVC pattern through a Lego-based analogy Learn what models, views, and controllers are conceptually […]

Read more

Visualizing Data in Python With Seaborn

If you have some experience using Python for data analysis, chances are you’ve produced some data plots to explain your analysis to other people. Most likely you’ll have used a library such as Matplotlib to produce these. If you want to take your statistical visualizations to the next level, you should master the Python seaborn library to produce impressive statistical analysis plots that will display your data. Before you start, you should familiarize yourself with the Jupyter Notebook data analysis […]

Read more

Python Basics Exercises: Dictionaries

In plain English, a dictionary is a book containing the definitions of words. Each entry in a dictionary has two parts: the word being defined, and its definition. Python dictionaries, like lists and tuples, store a collection of objects. However, instead of storing objects in a sequence, dictionaries hold information in pairs of data called key-value pairs. That is, each object in a dictionary has two parts: a key and a value. Each key is assigned a single value, which […]

Read more

Python News: What’s New From February 2024

As February takes a rare leap forward with an extra day this year, the Python community followed suit! Python versions 3.12 and 3.11 receive a security fix, and CPython source distributions now document the software supply chain to allow for a more effective vulnerability detection. Another Rust-based tool makes its way into the Python ecosystem, promising exciting improvements to the existing package management system. Looking ahead, the reveal of the PyCon US 2024 schedule gives us a glimpse into the […]

Read more
1 2 3 163