Python tutorials

Managing Multiple Python Versions With pyenv

Interactive Quiz ⋅ 9 QuestionsBy Martin Breuss In this quiz, you’ll test your understanding of how to use pyenv to manage multiple versions of Python. You’ll revisit how to install multiple versions of Python and switch between the installed versions. The quiz contains 9 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! « Browse All […]

Read more

Practical Prompt Engineering

Interactive Quiz ⋅ 13 QuestionsBy Martin Breuss In this quiz, you’ll test your understanding of Practical Prompt Engineering for large language models (LLMs). By working through this quiz, you’ll revisit how to work with OpenAI’s GPT-3.5 and GPT-4 models through their API, apply prompt engineering techniques to a practical, real-world example, and use strategies like numbered steps, delimiters, few-shot prompting, chain-of-thought prompting, and roles in messages to improve your results. The quiz contains 13 questions and there is no time […]

Read more

Supercharge Your Classes With Python super()

Interactive Quiz ⋅ 5 QuestionsBy Martin Breuss In this quiz, you’ll test your understanding of inheritance and the super() function in Python. By working through this quiz, you’ll revisit the concept of inheritance, multiple inheritance, and how the super() function works in both single and multiple inheritance scenarios. 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 […]

Read more

Format Floats Within F-Strings

Interactive Quiz ⋅ 6 QuestionsBy Bartosz Zaczyński In this quiz, you’ll test your understanding of How to Format Floats Within F-Strings in Python. You’ll often need to format and round a Python float to display the results of your calculations neatly within strings. While there are several ways to format numbers in Python, formatted string literals or f-strings are usually the most frequent choice in modern Python programs. Knowing how to use f-strings effectively can make your code more readable […]

Read more

How to Format Floats Within F-Strings in Python

You’ll often need to format and round a Python float to display the results of your calculations neatly within strings. In earlier versions of Python, this was a messy thing to do because you needed to round your numbers first and then use either string concatenation or the old string formatting technique to do this for you. Since Python 3.6, the literal string interpolation, more commonly known as a formatted string literal or f-string, allows you to customize the content […]

Read more

Using raise for Effective Exceptions

In your Python journey, you’ll come across situations where you need to signal that something is going wrong in your code. For example, maybe a file doesn’t exist, a network or database connection fails, or your code gets invalid input. A common approach to tackle these issues is to raise an exception, notifying the user that an error has occurred. That’s what Python’s raise statement is for. Learning about the raise statement allows you to effectively handle errors and exceptional […]

Read more

Build a Blog Using Django, GraphQL, and Vue

Are you a regular Django user? Do you find yourself wanting to decouple your back end and front end? Do you want to handle data persistence in the API while you display the data in a single-page app (SPA) in the browser using a JavaScript framework like React or Vue? If you answered yes to any of these questions, then you’re in luck. This tutorial will take you through the process of building a Django blog back end and a […]

Read more

Pydantic: Simplifying Data Validation in Python

Pydantic’s primary way of defining data schemas is through models. A Pydantic model is an object, similar to a Python dataclass, that defines and stores data about an entity with annotated fields. Unlike dataclasses, Pydantic’s focus is centered around automatic data parsing, validation, and serialization. The best way to understand this is to create your own models, and that’s what you’ll do next. Working With Pydantic BaseModels Suppose you’re building an application used by a human resources department to manage […]

Read more

Generating QR Codes With Python

From restaurant e-menus to airline boarding passes, QR codes have numerous applications that impact your day-to-day life and enrich the user’s experience. Wouldn’t it be great to make them look good, too? With the help of this video course, you’ll learn how to use Python to generate beautiful QR codes for your personal use case. In its most basic format, a QR code contains black squares and dots on a white background, with information that any smartphone or device with […]

Read more

Python News: What’s New From March 2024

While many people went hunting for Easter eggs, the Python community stayed active through March 2024. The free-threaded Python project reached a new milestone, and you can now experiment with disabling the GIL in your interpreter. The Python Software Foundation does a great job supporting the language with limited resources. They’ve now announced a new position that will support users of PyPI. NumPy is an old workhorse in the data science space. The library is getting a big facelift, and […]

Read more
1 2 3 164