In this course, you’ve reviewed what you learned in Python Basics: Lists and Tuples. You’ve used Python lists and tuples to store collections of objects, and you’ve gained a stronger understanding of the best use cases for each data type.
In this video course, you’ve practiced:
- Defining and manipulating lists and tuples in Python
- Leveraging the unique qualities of lists and tuples
- Determining when you should use lists vs tuples
Now you have an even stronger grasp of Python lists and tuples, and you’re ready to effectively incorporate them into your own programming projects.
For more on lists and tuples, check out:
Bartosz Zaczyński RP Team on Feb. 9, 2024
@alvesmig At the end of the day, what really matters is that your code works as expected and that it gives you the correct result. Once you’ve tested the code for correctness, you may start thinking of ways to make it better, which is a highly subjective matter. Do you intend to make it run faster, use fewer dependencies, look more concise, or be easier to maintain?
Knowing where to set the boundaries between your functions is a skill that comes through practice. After some time, it starts to feel natural when to define a function and which code to put into it.
As a rule of thumb, defining small functions with clear responsibilities is considered a good practice. That way, you can reuse your functions in different situations and even combine them with others in flexible ways. In contrast, keeping most of your code within a single function or the global scope can make it more difficult to test, understand, and reuse.