In this tutorial, you'll learn how to properly define constants in Python. By coding a bunch of practical example, you'll also learn how Python constants can improve your code's readability, reusability, and maintainability.| realpython.com
In this tutorial, you'll learn about recursion in Python. You'll see what recursion is, how it works in Python, and under what circumstances you should use it. You'll finish by exploring several examples of problems that can be solved both recursively and non-recursively.| realpython.com
Understand Python's with statement and context managers to streamline the setup and teardown phases in resource management. Start writing safer code today!| realpython.com
In this tutorial, you'll learn about the Python modulo operator (%). You'll look at the mathematical concepts behind the modulo operation and how the modulo operator is used with Python's numeric types. You'll also see ways to use the modulo operator in your own code.| realpython.com
Python 3.14 enters its release candidate phase, Django turns 20, and exciting updates about tools, libraries, and the Python community.| realpython.com
In this step-by-step tutorial you'll learn how to work with conditional ("if") statements in Python. Master if-statements and see how to write complex decision making code in your programs.| realpython.com
In this step-by-step tutorial, you will learn how to leverage single and multiple inheritance in your object-oriented application to supercharge your classes with Python super().| realpython.com
In this tutorial, you'll learn the difference between the string representations returned by .__repr__() vs .__str__() and understand how to use them effectively in classes that you define.| realpython.com
In this step-by-step tutorial, you'll learn how Python's map() works and how to use it effectively in your programs. You'll also learn how to use list comprehension and generator expressions to replace map() in a Pythonic and efficient way.| realpython.com
In this step-by-step tutorial, you'll learn how Python's .append() works and how to use it for adding items to your list in place. You'll also learn how to code your own stacks and queues using .append() and .pop().| realpython.com
In this tutorial, you'll learn how Python mutable and immutable data types work internally and how you can take advantage of mutability or immutability to power your code.| realpython.com
With this opinionated guide to setting up a basic, fully featured and flexible setup for Python coding and open source contributing when working from Windows, you'll go from a fresh install to ready to contribute, and even check out a PowerShell script to automate much of the process.| realpython.com
In this step-by-step tutorial, you'll learn what Python's OrderedDict is and how to use it in your code. You'll also learn about the main differences between regular dictionaries and ordered dictionaries.| realpython.com
Come learn with Python experts at the Real Python Office Hours, a weekly video call that offers Real Python members the chance to get help with Python-related questions, meet new Pythonistas, learn about new and trending topics in the community, and get feedback and tips on Python code and projects.| realpython.com
In this tutorial, you'll learn how you can work with files in Python by using built-in modules to perform practical tasks that involve groups of files, like renaming them, moving them around, archiving them, and getting their metadata.| realpython.com
Help your team master real-world Python skills with hands-on courses and a community of experts.| realpython.com
In this tutorial, you'll learn about indefinite iteration using the Python while loop. You'll be able to construct basic and complex while loops, interrupt loop execution with break and continue, use the else clause with a while loop, and deal with infinite loops.| realpython.com
In this tutorial, you'll learn what magic methods are in Python, how they work, and how to use them in your custom classes to support powerful features in your object-oriented code.| realpython.com
Python's Global Interpreter Lock or GIL, in simple words, is a mutex (or a lock) that allows only one thread to hold the control of the Python interpreter at any one time. In this article you'll learn how the GIL affects the performance of your Python programs.| realpython.com
In this step-by-step tutorial, you’ll learn all about Python’s math module for higher-level mathematical functions. Whether you’re working on a scientific project, a financial application, or any other type of programming endeavor, you just can’t escape the need for math!| realpython.com
In this tutorial, you'll learn how to use Python's assignment operators to write assignment statements that allow you to create, initialize, and update variables in your code.| realpython.com
In this tutorial, you'll learn the basics of the C language, which is used in the source code for CPython, the most popular Python implementation. Learning C is important for Python programmers interested in contributing to CPython.| realpython.com
If you use Python's print() function to get information about the flow of your programs, then logging is the natural next step for you. This tutorial will guide you through creating your first logs and show you ways to curate them to grow with your projects.| realpython.com
The Zen of Python is a list of 19 guiding principles for good programs. Understand its purpose, history, and hidden jokes to improve your code today!| realpython.com
Model citizens use context managers to open and close file resources in Python, but have you ever wondered why it's important to close files? In this tutorial, you'll take a deep dive into the reasons why it's important to close files and what can happen if you don't.| realpython.com
In this tutorial, you'll learn how to use the Python standard REPL (Read-Eval-Print Loop) to run your code interactively. This tool will allow you to test new ideas, explore and experiment with new tools and libraries, refactor and debug your code, try out examples, and more.| realpython.com
In this step-by-step tutorial, you'll see common examples of invalid syntax in Python and learn how to resolve the issue. If you've ever received a SyntaxError when trying to run your Python code, then this is the guide for you!| realpython.com
In this tutorial, you'll learn about the Python pass statement, which tells the interpreter to do nothing. Even though pass has no effect on program execution, it can be useful. You'll see several use cases for pass as well as some alternative ways to do nothing in your code.| realpython.com
In this step-by-step tutorial, you'll learn how to read and understand the information you can get from a Python traceback. You'll walk through several examples of tracebacks and see some of the most common tracebacks in Python.| realpython.com
In this tutorial, you'll learn about numbers and basic math in Python. You'll explore integer, floating-point numbers, and complex numbers and see how perform calculations using Python's arithmetic operators, math functions, and number methods.| realpython.com
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.| realpython.com
Master the Python range() function and learn how it works under the hood. You most commonly use ranges in loops. In this tutorial, you'll learn how to iterate over ranges but also identify when there are better alternatives.| realpython.com
In this tutorial, you'll dive deep into Python's lists. You'll learn how to create them, update their content, populate and grow them, and more. Along the way, you'll code practical examples that will help you strengthen your skills with this fundamental data type in Python.| realpython.com
In this tutorial, you'll learn what iterators and iterables are in Python. You'll learn how they differ and when to use them in your code. You'll also learn how to create your own iterators and iterables to make data processing more efficient.| realpython.com
In this tutorial, you'll learn how class constructors work in Python. You'll also explore Python's instantiation process, which has two main steps: instance creation and instance initialization.| realpython.com
Python list comprehensions help you to create lists while performing sophisticated filtering, mapping, and conditional logic on their members. In this tutorial, you'll learn when to use a list comprehension in Python and how to create them effectively.| realpython.com
Learn how to work effectively with Python sets. You’ll define set objects, explore supported operations, and understand when sets are the right choice for your code.| realpython.com
In this tutorial, you'll learn how to work with Python dictionaries to help you process data more efficiently. You'll learn how to create dictionaries, access their keys and values, update dictionaries, and more.| realpython.com
Learn how to read, process, and parse CSV from text files using Python. You'll see how CSV files work, learn the all-important "csv" library built into Python, and see how CSV parsing works using the "pandas" library.| realpython.com
Join us live for an exclusive members-only Q&A session with the Real Python team. You'll meet fellow Pythonistas to chat about your learning progress, ask questions, and discuss Python tips & tricks via screen sharing. Simply register for upcoming events on this page.| realpython.com
In this guide, you'll learn how to get the most out of your Real Python membership using the community Slack. You'll learn some lesser-known features of Slack and see how to communicate your technical problems more effectively.| realpython.com
In this tutorial, you'll learn all about object-oriented programming (OOP) in Python. You'll learn the basics of the OOP paradigm and cover concepts like classes and inheritance. You'll also see how to instantiate an object from a class.| realpython.com
Learn how to write high-quality, readable code by using the Python style guidelines laid out in PEP 8. Following these guidelines helps you make a great impression when sharing your work with potential employers and collaborators.| realpython.com
This article explores Python modules and Python packages, two mechanisms that facilitate modular programming.| realpython.com
In this tutorial, you'll learn how to create and use full-featured classes in your Python code. Classes provide a great way to solve complex programming problems by approaching them through models that represent real-world objects.| realpython.com
Python's f-strings provide a readable way to interpolate and format strings. They're readable, concise, and less prone to error than traditional string interpolation and formatting tools, such as the .format() method and the modulo operator (%). F-strings are also faster than those tools!| realpython.com
In this beginner tutorial, you'll learn what exceptions are good for in Python. You'll see how to raise exceptions and how to handle them with try ... except blocks.| realpython.com
The Python import system is as powerful as it is useful. In this in-depth tutorial, you'll learn how to harness this power to improve the structure and maintainability of your code.| realpython.com
In this tutorial, you'll learn how to use the development environment included with your Python installation. Python IDLE is a small program that packs a big punch! You'll learn how to use Python IDLE to interact with Python directly, work with Python files, and improve your development workflow.| realpython.com
In this tutorial, you'll explore the various ways of interacting with Python. You'll learn about the REPL for quick testing and running scripts, as well as how to work with IDEs, Jupyter Notebooks, and online interpreters.| realpython.com
In this tutorial, you'll learn how to use Python's rich set of operators and functions for working with strings. You'll cover the basics of creating strings using literals and the str() function, applying string methods, using operators and built-in functions with strings, and more!| realpython.com
In this step-by-step tutorial, you'll learn what scopes are, how they work, and how to use them effectively to avoid name collisions in your code. Additionally, you'll learn how to take advantage of a Python scope to write more maintainable and less buggy code.| realpython.com
In this step-by-step tutorial, you'll learn how to use the Python return statement when writing functions. Additionally, you'll cover some good programming practices related to the use of return. With this knowledge, you'll be able to write readable, robust, and maintainable functions in Python.| realpython.com
In this step-by-step tutorial, you'll learn about the print() function in Python and discover some of its lesser-known features. Avoid common mistakes, take your "hello world" to the next level, and know when to use a better alternative.| realpython.com
In this tutorial, you'll learn about functional programming in Python. You'll see what functional programming is, how it's supported in Python, and how you can use it in your Python code.| realpython.com
In this tutorial, you'll learn about the basic data types that are built into Python, including numbers, strings, bytes, and Booleans.| realpython.com
In this tutorial, you'll learn about the NoneType object None, which acts as the null in Python. This object represents emptiness, and you can use it to mark default parameters and even show when you have no result. None is a tool for doing everything with nothing!| realpython.com
In this tutorial, you'll learn how to define and call your own Python function. You'll also learn about passing data to your function, and returning data from your function back to its calling environment.| realpython.com
In this tutorial, you'll learn the key characteristics of lists and tuples in Python, as well as how to define and manipulate them. When you're finished, you'll have a good feel for when to use a tuple vs a list in a Python program.| realpython.com
In this tutorial, you'll learn what APIs are and how to consume them using Python. You'll also learn some core concepts for working with APIs, such as status codes, HTTP methods, the requests library, and much more. You'll also see a few examples of real-life APIs and how to consume them.| realpython.com
In this tutorial, you'll learn all about the Python for loop. You'll learn how to use this loop to iterate over built-in data types, such as lists, tuples, strings, and dictionaries. You'll also explore some Pythonic looping techniques and much more.| realpython.com
A Python script or program is a file containing executable Python code. Being able to run Python scripts and code is probably the most important skill that you need as a Python developer. By running your code, you'll know if it works as planned.| realpython.com
Large language models (LLMs) have taken the world by storm, demonstrating unprecedented capabilities in natural language tasks. In this step-by-step tutorial, you'll leverage LLMs to build your own retrieval-augmented generation (RAG) chatbot using synthetic data with LangChain and Neo4j.| realpython.com
In this in-depth tutorial, you’ll see how to create Python unit tests, execute them, and find the bugs before your users do. You’ll learn about the tools available to write and execute tests, check your application’s performance, and even look for security issues.| realpython.com
The first step to getting started with Python is to install it on your machine. In this tutorial, you'll learn how to check which version of Python, if any, you have on your Windows, Mac, or Linux computer and the best way to install the most recent version in any environment.| realpython.com
Join the Real Python Community Chat and meet the Real Python Team and other Pythonistas looking to improve their skills. Discuss your coding and career questions, celebrate your progress, vote on upcoming tutorial topics, or just hang out with us at this virtual water cooler.| realpython.com
In this tutorial, you'll learn a few Python naming conventions involving single and double underscores (_). You'll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.| realpython.com
In this tutorial on Python's Requests library, you'll see some of the most useful features that Requests has to offer as well as ways to customize and optimize those features. You'll learn how to use requests efficiently and stop requests to external services from slowing down your application.| realpython.com
In this step-by-step tutorial, you'll learn the basics of Python programming with the help of a simple and interactive Python library called turtle. If you're a beginner to Python, then this tutorial will definitely help you on your journey as you take your first steps into the world of programming.| realpython.com
Whether you're a teacher looking for some inspiration for your holiday wishlist, or a student looking for a gift for your favorite computer science teacher, this episode has you covered. From practical tools like an online course about Python, to fun gadgets like a Lego rollercoaster or desktop robot, there's something for everyone on this list.| Teaching Python
In this tutorial, you'll look at what Python decorators are and how you define and use them. Decorators can make your code more readable and reusable. Come take a look at how decorators work under the hood and practice writing your own decorators.| realpython.com
Data classes are one of the new features of Python 3.7. With data classes you do not have to write boilerplate code to get proper initialization, representation and comparisons for your objects.| realpython.com