Python tutorials

Quiz: How to Remove Items From Lists in Python

Interactive Quiz ⋅ 6 QuestionsBy Leodanis Pozo Ramos Share In this quiz, you’ll test your understanding of How to Remove Items From Lists in Python. By working through this quiz, you’ll revisit the different approaches to removing items from a list in Python, including .pop(), .remove(), the del statement, and more. 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 quiz, you’ll receive a total […]

Read more

Get Started With Django User Management

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: Building a Django User Management System Django user management allows you to integrate user authentication and management into your web applications. By using Django, you can leverage the framework’s built-in authentication system to manage user registration, login, and logout. With just a few additional templates, you can enable users to reset and change their […]

Read more

Programming Sockets in Python

Sockets and the socket API are used to send messages across a network. They provide a form of inter-process communication (IPC). The network can be a logical, local network to the computer, or one that’s physically connected to an external network with its own connections to other networks. The obvious example is the Internet, which you connect to via your ISP. In this video course, you’ll create: A simple socket server and client An improved version that handles multiple connections […]

Read more

Dictionaries in Python

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: Using Dictionaries in Python Python dictionaries are a powerful built-in data type that allows you to store key-value pairs for efficient data retrieval and manipulation. Learning about them is essential for developers who want to process data efficiently. In this tutorial, you’ll explore how to create dictionaries using literals and the dict() constructor, as […]

Read more

Object-Oriented Programming (OOP) in Python

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: Intro to Object-Oriented Programming (OOP) in Python Object-oriented programming (OOP) in Python lets you structure your code by grouping related properties and behaviors into individual objects. You create classes as blueprints and instantiate them to form objects. With OOP, you can model real-world entities and their interactions, and create complex systems with reusable components. […]

Read more

Python Set Comprehensions: How and When to Use Them

Python set comprehensions provide a concise way to create and manipulate sets in your code. They generate sets with a clean syntax, making your code more readable and Pythonic. With set comprehensions, you can create, transform, and filter sets, which are great skills to add to your Python programming toolkit. In this tutorial, you’ll learn the syntax and use cases of set comprehensions, ensuring you can decide when and how to use them in your code. Understanding set comprehensions will […]

Read more

Reducing CO₂ emissions with faster software

What can you as a software developer do to fight climate change? My first and primary answer is getting involved with local politics. However, if you write software that operates at sufficient scale, you can also reduce carbon emissions by making your software faster. In this article we’ll cover: Why more computation uses more electricity. Why you probably don’t need to think about this most of the time. Reducing emissions by reducing compute time. Reducing emissions with parallelism (even with […]

Read more

Python News Roundup: December 2024

The Python community has kept up its momentum this month, delivering a host of exciting updates. From the promising improvements to template strings in PEP 750 to the release of Python 3.14.0a2, innovation is front and center. Developers are exploring new tools like partial validation in Pydantic 2.10, while popular projects adapt to the end of life of Python 3.8. December also welcomes the return of the beloved Advent of Code, challenging programmers and problem solvers with daily puzzles. And […]

Read more

Expression vs Statement in Python: What’s the Difference?

After working with Python for a while, you’ll eventually come across two seemingly similar terms: expression and statement. When you browse the official documentation or dig through a Python-related thread on an online forum, you may get the impression that people use these terms interchangeably. That’s often true, but confusingly enough, there are cases when the expression vs statement distinction becomes important. So, what’s the difference between expressions and statements in Python? Take the Quiz: Test your knowledge with our […]

Read more

Handling or Preventing Errors in Python: LBYL vs EAFP

Dealing with errors and exceptional situations is a common requirement in programming. You can either prevent errors before they happen or handle errors after they’ve happened. In general, you’ll have two coding styles matching these strategies: look before you leap (LBYL), and easier to ask forgiveness than permission (EAFP), respectively. In this video course, you’ll dive into the questions and considerations surrounding LBYL vs EAFP in Python. By learning about Python’s LBYL and EAFP coding styles, you’ll be able to […]

Read more
1 2 3 182