Python tutorials

Quiz: How to Integrate Local LLMs With Ollama and Python

Interactive Quiz ⋅ 8 QuestionsBy Bartosz Zaczyński Share In this quiz, you’ll test your understanding of How to Integrate Local LLMs With Ollama and Python. By working through this quiz, you’ll revisit how to set up Ollama, pull models, and use chat, text generation, and tool calling from Python. You’ll connect to local models through the ollama Python library and practice sending prompts and handling responses. You’ll also see how local inference can improve privacy and cost efficiency while keeping […]

Read more

How to Integrate Local LLMs With Ollama and Python

Integrating local large language models (LLMs) into your Python projects using Ollama is a great strategy for improving privacy, reducing costs, and building offline-capable AI-powered apps. Ollama is an open-source platform that makes it straightforward to run modern LLMs locally on your machine. Once you’ve set up Ollama and pulled the models you want to use, you can connect to them from Python using the ollama library. Here’s a quick demo: In this tutorial, you’ll integrate local LLMs into your […]

Read more

uv vs pip: Python Packaging and Dependency Management

When it comes to Python package managers, the choice often comes down to uv vs pip. You may choose pip for out-of-the-box availability, broad compatibility, and reliable ecosystem support. In contrast, uv is worth considering if you prioritize fast installs, reproducible environments, and clean uninstall behavior, or if you want to streamline workflows for new projects. In this video course, you’ll compare both tools. To keep this comparison meaningful, you’ll focus on the overlapping features, primarily package installation and dependency […]

Read more

Quiz: How to Integrate ChatGPT’s API With Python Projects

Interactive Quiz ⋅ 8 QuestionsBy Bartosz Zaczyński Share In this quiz, you’ll test your understanding of How to Integrate ChatGPT’s API With Python Projects. By working through this quiz, you’ll revisit how to send prompts with the openai library, guide behavior with developer role messages, and handle text and code outputs. You’ll also see how to integrate AI responses into your Python scripts for practical tasks. The quiz contains 8 questions and there is no time limit. You’ll get 1 […]

Read more

How to Integrate ChatGPT’s API With Python Projects

Python’s openai library provides the tools you need to integrate the ChatGPT API into your Python applications. With it, you can send text prompts to the API and receive AI-generated responses. You can also guide the AI’s behavior with developer role messages and handle both simple text generation and more complex code creation tasks. Here’s an example: Python Script Output from a ChatGPT API Call Using openai After reading this tutorial, you’ll understand how examples like this work under the […]

Read more

Quiz: How to Create a Django Project

Interactive Quiz ⋅ 5 QuestionsBy Martin Breuss Share In this quiz, you’ll test your understanding of creating a Django project. By working through this quiz, you’ll revisit how to create and activate a virtual environment, install Django and pin your dependencies, start a Django project, and start a Django app. You will also see how isolating dependencies helps others reproduce your setup. To revisit and keep learning, watch the video course on How to Set Up a Django Project. The […]

Read more

How to Create a Django Project

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: How to Set Up a Django Project Before you can start building your Django web application, you need to set up your Django project. In this guide you’ll learn how to create a new Django project in four straightforward steps and only six commands: Step Description Command 1a Set up a virtual environment python […]

Read more

Intro to Object-Oriented Programming (OOP) in Python

Object-oriented programming (OOP) is one of the most significant and essential topics in programming. This course will give you a foundational conceptual understanding of object-oriented programming to help you elevate your Python skills. You’ll learn how to define custom types using classes and how to instantiate those classes into Python objects that can be used throughout your program. Finally, you’ll discover how classes can inherit from one another, with a brief introduction to inheritance, enabling you to write maintainable and […]

Read more

Unit testing your code’s performance, part 1: Big-O scaling

When you implement an algorithm, you also implement tests to make sure the outputs are correct. This can help you: Ensure your code is correct. Catch problems if and when you change it in the future. If you’re trying to make sure your software is fast, or at least doesn’t get slower, automated tests for performance would also be useful. But where should you start? My suggestion: start by testing big-O scaling. It’s a critical aspect of your software’s speed, […]

Read more

Quiz: How to Properly Indent Python Code

Interactive Quiz ⋅ 5 QuestionsBy Philipp Acsany Share In this quiz, you’ll test your understanding of How to Indent in Python. By working through this quiz, you’ll revisit how to properly indent Python code, choose helpful editor settings, use spaces properly, apply code formatters, and explain why indentation is required. 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. […]

Read more
1 2 3 208