Python tutorials

Using Type Hints for Multiple Return Types in Python

In Python, type hinting is an optional yet useful feature for making your code easier to read, reason about, and debug. With type hints, you let other developers know the expected data types for variables, function arguments, and return values. As you write code for applications that require greater flexibility, you may need to specify multiple return types to make your code more robust and adaptable to different situations. You’ll encounter different use cases where you may want to annotate […]

Read more

Quiz: Python Thread Safety: Using a Lock and Other Techniques

Interactive Quiz ⋅ 8 QuestionsBy Martin Breuss Share In this quiz, you’ll test your understanding of Python threading and thread safety. You’ll revisit concepts such as race conditions, thread safety issues, and synchronization primitives in the threading module. This knowledge is crucial when working with multithreaded code using Python’s threading module and ThreadPoolExecutor. The quiz contains 8 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 […]

Read more

Syntactic Sugar: Why Python Is Sweet and Pythonic

Python has several pieces of syntax that are syntactic sugar. This sugar is syntax that isn’t strictly necessary but gives Python some of its flavor as a readable, beginner-friendly, and powerful language. In this tutorial, you’ll explore some of Python’s most used pieces of syntactic sugar. In practice, you already use most of these pieces of syntax, as they include many well-known Pythonic constructs. As you read on, you’ll see how Python works under the hood and learn how to […]

Read more

Quiz: Structural Pattern Matching

Interactive Quiz ⋅ 11 QuestionsBy Bartosz Zaczyński Share In this quiz, you’ll test your understanding of Structural Pattern Matching in Python. You’ll revisit the syntax of the match statement and case clauses, explore various types of patterns supported by Python, and learn about guards, unions, aliases, and name binding. The quiz contains 11 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 […]

Read more

Quiz: Python Closures: Common Use Cases and Examples

Interactive Quiz ⋅ 6 QuestionsBy Leodanis Pozo Ramos Share In this quiz, you’ll test your understanding of Python closures. Closures are a common feature in functional programming languages and are particularly popular in Python because they allow you to create function-based decorators. Take this quiz after reading our Python Closures: Common Use Cases and Examples tutorial. The quiz contains 6 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the […]

Read more

Build a Contact Book App With Python, Textual, and SQLite

Building projects is a great way to learn programming and have fun at the same time. When you work on a project, you apply different coding skills simultaneously, which is good practice for what you’ll do in a real-life project. In this tutorial, you’ll create a contact book application with a text-based interface (TUI) based on Python and Textual. To store the contact data, your app will use an SQLite database. In this tutorial, you’ll learn how to: Create the […]

Read more

What’s New in Python 3.13

Python 3.13 was published on October 7, 2024. This new version is a major step forward for the language, although several of the biggest changes are happening under the hood and won’t be immediately visible to you. In a sense, Python 3.13 is laying the groundwork for some future improvements, especially to the language’s performance. As you watch the course, you’ll learn more about the background for this and dive into some new features that are fully available now. In […]

Read more

Python News Roundup: October 2024

October is always an important month for Python, as this is when a new major version is released. Python 3.13 is the new version this year, and it brings several new features that lay the groundwork for other changes in the future. As one version of Python comes to life, another is put to rest. Python 3.8 is already five years old, which means that this version won’t be supported any longer. There are also exciting developments happening in the […]

Read more

Quiz: Iterators and Iterables in Python: Run Efficient Iterations

Interactive Quiz ⋅ 20 QuestionsBy Martin Breuss Share In this quiz, you’ll test your understanding of Python’s Iterators and Iterables. By working through this quiz, you’ll revisit how to create and work with iterators and iterables, understand the differences between them, and review how to use generator functions and the yield statement. The quiz contains 20 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 […]

Read more

Quiz: Python import: Advanced Techniques and Tips

Interactive Quiz ⋅ 5 QuestionsBy Martin Breuss Share In this quiz, you’ll test your understanding of Python’s import statement and related topics. By working through this quiz, you’ll revisit how to use modules in your scripts and import modules dynamically at runtime. The quiz contains 5 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! « […]

Read more
1 21 22 23 24 25 200