Python tutorials

Quiz: Write Pythonic and Clean Code With namedtuple

Interactive Quiz ⋅ 11 QuestionsBy Martin Breuss In this quiz, you’ll test your understanding of Python’s namedtuple(). By working through this quiz, you’ll revisit how to create namedtuple classes, identify and take advantage of the cool features of namedtuple, use namedtuple instances to write Pythonic code, and decide when to use a namedtuple over a similar data structure. The quiz contains 11 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end […]

Read more

Quiz: Python’s unittest: Writing Unit Tests for Your Code

Interactive Quiz ⋅ 12 QuestionsBy Leodanis Pozo Ramos In this quiz, you’ll test your understanding of testing your Python code with the unittest framework. Testing in Python is a huge topic and can come with a lot of complexity, but it doesn’t need to be hard. You can create simple tests for your application in a few easy steps and then build on them from there. With this quiz, you can check your understanding of testing with Python’s unittest framework. […]

Read more

Quiz: Python Sequences: A Comprehensive Guide

Interactive Quiz ⋅ 12 QuestionsBy Martin Breuss In this quiz, you’ll test your understanding of Python sequences. By working through this quiz, you’ll revisit the basic characteristics of a sequence, operations common to most sequences, special methods associated with sequences, and how to create user-defined mutable and immutable sequences. The quiz contains 12 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 […]

Read more

Quiz: What Is the __pycache__ Folder in Python?

Interactive Quiz ⋅ 13 QuestionsBy Bartosz Zaczyński As your Python project grows, you typically organize your code in modules and packages for easier maintenance and reusability. When you do that, you’ll likely notice the sudden emergence of a __pycache__ folder alongside your original files, popping up in various locations unexpectedly. The quiz contains 13 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

Fine-tune Llama 3 with ORPO

ORPO is a new exciting fine-tuning technique that combines the traditional supervised fine-tuning and preference alignment stages into a single process. This reduces the computational resources and time required for training. Moreover, empirical results demonstrate that ORPO outperforms other alignment methods on various model sizes and benchmarks. In this article, we will fine-tune the new Llama 3 8B model using ORPO with the TRL library. The code is available on Google Colab and in the LLM Course on GitHub. ⚖️ […]

Read more

What’s Lazy Evaluation in Python?

Interactive Quiz ⋅ 7 QuestionsBy Bartosz Zaczyński Lazy evaluation is a programming concept where the evaluation of an expression is deferred until its value is actually needed. This can lead to performance enhancements by avoiding unnecessary calculations, and it can also allow for the creation of potentially infinite data structures. As you embark on this quiz, you’ll test your knowledge of lazy evaluation in Python and learn how to apply this concept to write cleaner and more efficient code. The […]

Read more

Python Sequences: A Comprehensive Guide

Interactive Quiz ⋅ 12 QuestionsBy Martin Breuss In this quiz, you’ll test your understanding of Python sequences. By working through this quiz, you’ll revisit the basic characteristics of a sequence, operations common to most sequences, special methods associated with sequences, and how to create user-defined mutable and immutable sequences. The quiz contains 12 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 […]

Read more

Python Basics Exercises: Scopes

On your Python journey, you’ve worked with functions and loops. To fully understand functions and loops in Python, you need to be familiar with the issue of scope. In this Python Basics Exercises video course, you’ll practice: Identifying the scope of objects Working with the global keyword Exploring the LEGB rule for scope resolution Using the return statement in a function Scope can be one of the more difficult programming concepts to understand, so in this video course, you’ll get […]

Read more

Write Unit Tests for Your Python Code With ChatGPT

Having a good battery of tests for your code may be a requirement for many Python projects. In practice, writing unit tests is hard and can take a lot of time and effort. Therefore, some developers don’t like to write them. However, with large language models (LLMs) and tools like ChatGPT, you can quickly create robust and complete sets of tests for your Python code. In Python, you can use multiple different tools for writing tests. The most commonly used […]

Read more

Python’s unittest: Writing Unit Tests for Your Code

Interactive Quiz ⋅ 12 QuestionsBy Leodanis Pozo Ramos In this quiz, you’ll test your understanding of testing your Python code with the unittest framework. Testing in Python is a huge topic and can come with a lot of complexity, but it doesn’t need to be hard. You can create simple tests for your application in a few easy steps and then build on them from there. With this quiz, you can check your understanding of testing with Python’s unittest framework. […]

Read more
1 16 17 18 19 20 182