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

Python’s tuple Data Type: A Deep Dive With Examples

In Python, a tuple is a built-in data type that allows you to create immutable sequences of values. The values or items in a tuple can be of any type. This makes tuples pretty useful in those situations where you need to store heterogeneous data, like that in a database record, for example. Through this tutorial, you’ll dive deep into Python tuples and get a solid understanding of their key features and use cases. This knowledge will allow you to […]

Read more

What’s New in Python 3.12

It’s that time of year again, time for a new release of Python. Although Python 3.12 mostly focuses on internal improvements, there’s a little something for everyone. You can read up on all the new features by checking out the changelog. In this video course, you’ll learn about the following changes: Improvements to f-strings More did-you-mean error messages New features in the standard library Additions to static typing Changes to the CPython interpreter In this video course, you’ll explore these […]

Read more

Python 3.12: Cool New Features for You to Try

Python 3.12 was published on October 2, 2023. As usual, the new version comes out in October after lots of effort by volunteers worldwide. The new version comes with several new features and improvements that you’ll explore in this tutorial. You can also dive into the documentation to see a complete list of all changes. In this tutorial, you’ll learn about new features and improvements, like: Better error messages with helpful suggestions and guidance More expressive f-strings that are backed […]

Read more

Python 3.12 Preview: Static Typing Improvements

Python’s support for static typing gradually improves with each new release of Python. The core features were in place in Python 3.5. Since then, there’ve been many tweaks and improvements to the type hinting system. This evolution continues in Python 3.12, which, in particular, simplifies the typing of generics. In this tutorial, you’ll: Use type variables in Python to annotate generic classes and functions Explore the new syntax for type hinting type variables Model inheritance with the new @override decorator […]

Read more

Python Basics Exercises: Conditional Logic and Control Flow

In Python Basics: Conditional Logic and Control Flow, you learned that much of the Python code you’ll write is unconditional. That is, the code doesn’t make any choices. Every line of code is executed in the order that it’s written or in the order that functions are called, with possible repetitions inside loops. In this course, you’ll revisit how to use conditional logic to write programs that perform different actions based on different conditions. Paired with functions and loops, conditional […]

Read more

Python 3.12 Preview: Subinterpreters

Now that you know what a Python subinterpreter is, you’ll take a look at what’s changing in the upcoming releases of CPython. Most of the subinterpreter changes are described in two proposals, PEP 684 and PEP 554. Only PEP 684 will make it into the 3.12 release. PEP 554 is scheduled for the 3.13 release but hasn’t been officially approved yet. Changes to the Global State and the GIL The main focus of PEP 684 is refactoring the internals of […]

Read more

Speeding up your code when multiple cores aren’t an option

The common advice when Python is too slow is to switch to a low-level compiled language like Cython or Rust. But what do you do if that code is too slow? At that point you might start thinking about parallelism: using multi-threading or multi-processing so you can take advantage of multiple CPU cores. But parallelism comes with its own set of complexities; at the very least, some algorithms can only really work in a single-threaded way. So what can you […]

Read more

How to Catch Multiple Exceptions in Python

In this tutorial, you’ll learn various techniques to catch multiple exceptions with Python. To begin with, you’ll review Python’s exception handling mechanism before diving deeper and learning how to identify what you’ve caught, sometimes ignore what you’ve caught, and even catch lots of exceptions. Python raises an exception when your code encounters an occasional but not unexpected error. For example, this will occur if you try to read a missing file. Because you’re aware that such exceptions may occur, you […]

Read more
1 87 88 89 90 91 913