Python tutorials

Quiz: Python “for” Loops: The Pythonic Way

Interactive Quiz ⋅ 11 QuestionsBy Leodanis Pozo Ramos Share In this quiz, you’ll test your understanding of Python’s for loop. By working through this quiz, you’ll revisit how to iterate over items in a data collection, how to use range() for a predefined number of iterations, and how to use enumerate() for index-based iteration. 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 […]

Read more

Quiz: How to Split a String in Python

Interactive Quiz ⋅ 9 QuestionsBy Martin Breuss Share In this quiz, you’ll test your understanding of Python’s .split() method. Python’s .split() method lets you divide a string into a list of substrings based on a specified delimiter. By default, .split() separates at whitespace, including spaces, tabs, and newlines. You can customize .split() to work with specific delimiters using the sep parameter, and control the amount of splits with maxsplit. The quiz contains 9 questions and there is no time limit. […]

Read more

How to Split a String in Python

Python’s .split() method lets you divide a string into a list of substrings based on a specified delimiter. By default, .split() separates at whitespace, including spaces, tabs, and newlines. You can customize .split() to work with specific delimiters using the sep parameter, and control the amount of splits with maxsplit. By the end of this tutorial, you’ll understand that: You split a string by spaces in Python using .split() without arguments. Python’s .split() method can split on custom delimiters when […]

Read more

NumPy Techniques and Practical Examples

The NumPy library is a Python library used for scientific computing. It provides you with a multidimensional array object for storing and analyzing data in a wide variety of ways. In this video course, you’ll see examples of some features NumPy provides that aren’t always highlighted in other tutorials. In this video course, you’ll learn how to: Create multidimensional arrays from data stored in files Identify and remove duplicate data from a NumPy array Use structured NumPy arrays to reconcile […]

Read more

Python for Loops: The Pythonic Way

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: For Loops in Python (Definite Iteration) Python’s for loop allows you to iterate over the items in a collection, such as lists, tuples, strings, and dictionaries. The for loop syntax declares a loop variable that takes each item from the collection in each iteration. This loop is ideal for repeatedly executing a block of […]

Read more

The surprising way to save memory with BytesIO

If you need a file-like object that stores bytes in memory in Python, chances are you you’re using Pytho’s built-in io.BytesIO(). And since you’re already using an in-memory object, if your data is big enough you probably should try to save memory when reading that data back out. After all, it’s better not to have two copies of all the data in memory when only one will suffice. In this article we’ll cover: A quick intro to BytesIO. The memory […]

Read more

Creating a Scalable Flask Web Application From Scratch

Flask is a powerful and flexible micro web framework for Python, ideal for both small and large web projects. It provides a straightforward way to get a web application up and running, with all the features that you need to get started. Over the course of this video course, you’ll explore the process of creating a boilerplate for a Flask web project. This boilerplate will serve as a great starting point for any scalable Flask web app that you wish […]

Read more

Faster pip installs: caching, bytecode compilation, and uv

Installing your Python application’s dependencies can be surprisingly slow. Whether you’re running tests in CI, building a Docker image, or installing an application, downloading and installing dependencies can take a while. So how do you speed up installation with pip? In this article I’ll cover: Avoiding the slow path of installing from source. The package cache. Bytecode compilation and how it interacts with installation and startup speed. Using uv, a faster replacement for pip, and why it’s not always as […]

Read more

Quiz: How to Deal With Missing Data in Polars

Interactive Quiz ⋅ 10 QuestionsBy Ian Eyre Share In this quiz, you’ll test your understanding of How to Deal With Missing Data in Polars. By working through the questions, you’ll review your understanding of dealing with null values in Polars and also expand on what you learned in the tutorial. You’ll need to do some research outside of the tutorial to answer all the questions. Embrace this challenge and let it take you on a learning journey. The quiz contains […]

Read more

How to Deal With Missing Data in Polars

Efficiently handling missing data in Polars is essential for keeping your datasets clean during analysis. Polars provides powerful tools to identify, replace, and remove null values, ensuring seamless data processing. This tutorial covers practical techniques for managing missing data and highlights Polars’ capabilities to enhance your data analysis workflow. By following along, you’ll gain hands-on experience with these techniques and learn how to ensure your datasets are accurate and reliable. By the end of this tutorial, you’ll understand that: Polars […]

Read more
1 2 3 4 5 6 187