Python tutorials

Python Basics Exercises: Building Systems With Classes

In Python Basics: Building Systems With Classes, you moved beyond the basics of object-oriented programming (OOP), and started to put those classes to work. In this exercise course you will employ these capabilities to build more complex systems and write readable, reusable code. In this video course, you’ll practice the following: Compose classes together to create layers of functionality Inherit and override behavior from other classes to create variations Creatively mix and match these approaches Instantiate classes with attributes and […]

Read more

How to Run Your Python Scripts and Code

Watch Now This tutorial has a related video course created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Running Python Scripts A Python script or program is a file containing executable Python code. Being able to run Python scripts and code is probably the most important skill that you need as a Python developer. By running your code, you’ll know if it works as planned. You’ll also be able to test and […]

Read more

Speeding up Cython with SIMD

Cython allows you to write compiled extensions for Python, by translating Python-y code to C or C++. Often you’ll use it to speed up your software, and it’s especially useful for implementing small data science or scientific computing algorithms. But what happens when Cython is too slow? Often there’s still speed improvements you can do. In a previous article we focused on examples of optimizing your code to take advantage of things like instruction-level parallelism. In this article, we’ll focus […]

Read more

When should you upgrade to Python 3.12?

Python 3.12 is out now–but should you switch to it immediately? And if you shouldn’t upgrade just yet, when should you? Immediately after the release, you may not want to upgrade just yet. But from December 2023 and onwards, upgrading is definitely worth trying. To understand why, we need to consider Python packaging, the software development process, and take a look at the history of past releases. The problems with a new major Python release As with many open source […]

Read more

Python’s F-String for String Interpolation and Formatting

Python f-strings provide a quick way to interpolate and format strings. They’re readable, concise, and less prone to error than traditional string interpolation and formatting tools, such as the .format() method and the modulo operator (%). An f-string is also a bit faster than those tools! By the end of this tutorial, you’ll know why f-strings are such a powerful tool that you should learn and master as a Python developer. In this tutorial, you’ll learn how to: Interpolate values, […]

Read more

Python Basics Exercises: Object-Oriented Programming

In Python Basics: Object-Oriented Programming, you learned how OOP, or object-oriented programming, is a method of structuring a program by bundling related properties and behaviors into individual objects. In this video course, you’ll practice the following: Create a class, which is like a blueprint for creating an object Use classes to create new objects Instantiate classes with attributes and methods Use dunder methods like init() and str() This video course is part of the Python Basics series, which accompanies Python […]

Read more

Build a Blog From Scratch With Django

There are plenty of blogging platforms out there that you can use out of the box. However, building your own blog from scratch with Django is a great way to keep control over your content. Even if you’re just getting started with Django, its user-friendly features will allow you to focus on designing and posting your content. In this tutorial, you’ll learn how to: Set up a new Django project Create and edit blog posts Display posts to the user […]

Read more

How to Sort Unicode Strings Alphabetically in Python

Sorting strings in Python is something that you can almost take for granted if you do it all the time. Yet, it can become surprisingly tricky considering all the edge cases lurking in the vast Unicode standard. Understanding Unicode isn’t an easy feat, so prepare yourself for a whirlwind tour of surprising edge cases and effective ways of dealing with them. Note: In this tutorial, you’ll often use the term Unicode string to mean any string with non-Latin letters and […]

Read more

Using Python’s min() and max()

Python’s built-in min() and max() functions come in handy when you need to find the smallest and largest values in an iterable or in a series of regular arguments. Even though these might seem like fairly basic computations, they turn out to have many interesting use cases in real-world programing. You’ll try out some of those use cases here. In this video course, you’ll learn how to: Use Python’s min() and max() to find smallest and largest values in your […]

Read more

Python News: What’s New From September 2023

As the leaves turned yellow and fall set in, the Python community prepared for the release of Python 3.12 in early October. This new version of the most popular programming language brings several exciting new features, including better error messages and improvements to static typing. It also lays the groundwork for enhanced parallelism. Microsoft Excel is about to become a friendlier space for Pythonistas with the integration of the Python Editor, opening up new possibilities for those bridging the gap […]

Read more
1 34 35 36 37 38 189