Python tutorials

It’s time to stop using Python 3.8

Upgrading to new software versions is work, and work that doesn’t benefit your software’s users. Users care about features and bug fixes, not how up-to-date you are. So it’s perhaps not surprising how many people still use Python 3.8. As of September 2024, about 14% of packages downloaded from PyPI were for Python 3.8. This includes automated downloads as part of CI runs, so it doesn’t mean 3.8 is used in 14% of applications, but that’s still 250 million packages […]

Read more

When should you upgrade to Python 3.13?

Python 3.13 will be out October 1, 2024—but should you switch to it immediately? And if you shouldn’t upgrade just yet, when should you? Immediately after the release, you probably didn’t want to upgrade just yet. But from December 2024 and onwards, upgrading is definitely worth trying, though it may not succeed. 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 […]

Read more

Quiz: Python Virtual Environments: A Primer

Interactive Quiz ⋅ 10 QuestionsBy Kate Finegan Share So you’ve been primed on Python virtual environments! Test your understanding of the tutorial here. The quiz contains 10 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck! Start the Quiz » « Browse All Python Quizzes    

Read more

Quiz: Python 3.13: Free-Threading and a JIT Compiler

Interactive Quiz ⋅ 16 QuestionsBy Bartosz Zaczyński Share In this quiz, you’ll test your understanding of the new features in Python 3.13. By working through this quiz, you’ll revisit how to compile a custom Python build, disable the Global Interpreter Lock (GIL), enable the Just-In-Time (JIT) compiler, determine the availability of new features at runtime, assess the performance improvements in Python 3.13, and make a C extension module targeting Python’s new ABI. The quiz contains 16 questions and there is […]

Read more

How to Use Conditional Expressions With NumPy where()

The NumPy where() function is a powerful tool for filtering array elements in lists, tuples, and NumPy arrays. It works by using a conditional predicate, similar to the logic used in the WHERE or HAVING clauses in SQL queries. It’s okay if you’re not familiar with SQL—you don’t need to know it to follow along with this tutorial. You would typically use np.where() when you have an array and need to analyze its elements differently depending on their values. For […]

Read more

When to Use .__repr__() vs .__str__() in Python

One of the most common tasks that a computer program performs is to display data. The program often displays this information to the program’s user. However, a program also needs to show information to the programmer developing and maintaining it. The information a programmer needs about an object differs from how the program should display the same object for the user, and that’s where .__repr__() vs .__str__() comes in. A Python object has several special methods that provide specific behavior. […]

Read more

Python News Roundup: September 2024

As the autumn leaves start to fall, signaling the transition to cooler weather, the Python community has warmed up to a series of noteworthy developments. Last month, a new maintenance release of Python 3.12.5 was introduced, reinforcing the language’s ongoing commitment to stability and security. On a parallel note, Python continues its reign as the top programming language according to IEEE Spectrum’s annual rankings. This sentiment is echoed by the Python Developers Survey 2023 results, which reveal intriguing trends and […]

Read more

Quiz: Lists vs Tuples in Python

Interactive Quiz ⋅ 10 QuestionsBy Leodanis Pozo Ramos Share Challenge yourself with this quiz to evaluate and deepen your understanding of Python lists and tuples. You’ll explore key concepts, such as how to create and manipulate these data types, while also learning best practices for using them efficiently in your code. You can take this quiz after reading the Lists vs Tuples in Python tutorial. The quiz contains 10 questions and there is no time limit. You’ll get 1 point […]

Read more

Using Pydantic to Simplify Python Data Validation

Pydantic is a powerful data validation and settings management library for Python, engineered to enhance the robustness and reliability of your codebase. From basic tasks, such as checking whether a variable is an integer, to more complex tasks, like ensuring highly-nested dictionary keys and values have the correct data types, Pydantic can handle just about any data validation scenario with minimal boilerplate code. In this video course, you’ll learn how to: Work with data schemas with Pydantic’s BaseModel Write custom […]

Read more

Quiz: How to Use Conditional Expressions With NumPy where()

Interactive Quiz ⋅ 10 QuestionsBy Ian Eyre Share In this quiz, you’ll test your understanding of How to Use Conditional Expressions With NumPy where(). By working through the questions, you’ll consolidate the knowledge you gained from the tutorial and take yourself beyond what you learned. To answer some of the questions, you’ll need to do some research outside of the tutorial itself. Embrace this challenge because exploration can take you on a valuable learning journey. The quiz contains 10 questions […]

Read more
1 2 3 175