If you are working with large lists, you may need to have a sense of progress from time to time so that you do not just cluelessly stare at your screen.
This is where tqdm comes to help.
Continue readingSoftware engineering and personal development
If you are working with large lists, you may need to have a sense of progress from time to time so that you do not just cluelessly stare at your screen.
This is where tqdm comes to help.
Continue readingIf you have to find the union of elements that are either in the first or the second set, but not in both of them, then you need to use the symmetric difference.
This is also another math operation between sets that you have probably seen in a math class in high school.
This can be done quite easily and quickly using 2 built-in methods in Python.
Let’s start with the first one.
Continue readingIf you need to find whether 2 sets have the same elements, then you need to use an operation such as intersection.
This operation is known in Math and used everywhere. In Python, we have 2 built-in methods that we can use right away to find whether 2 sets have the same elements or not.
Continue readingIn the last article, we saw how we can find the difference between 2 sets in Python. In this article, we are going to see how to find the union of 2 sets.
This is actually quite similar to the difference.
We also have 2 ways to do the union of 2 sets in Python.
Continue readingThere can be cases when you may need to find the difference between 2 sets in Python. If you do not remember from high school, the difference between 2 sets means that we get the elements from the first set that are not in the second set.
We can do that quite easily in Python using the minus operator.
Continue readingIf your project is in some ways connected to a third-party API, then you are probably going to need to handle some JSON data.
In case you do not know what it means, it represents the most commonly used data format that is used to exchange data.
Continue readingIf you happen to need to concatenate a string with itself multiple times, you may think to actually write a loop and do the concatenation in that way:
Continue readingIf you happen to learn programming from a textbook, you may have seen an example where you are told to exercise writing a quick program that allows you to find the product of elements, for example:
Continue readingOne task that you need to do in your day-to-day work is to reverse a list.
One of the most common ways you can do that is by calling the reverse() method:
Continue readingIf you want to print multiple things in the same line, you do not need to clutter everything with the plus operator, or do some type of conversion and then do the concatenation.
For that, we are going to use the help of the “end” parameter inside the print() method indicating the type of separator that you want to use between the items that you want to print.
Continue reading© 2024 Fatos Morina
Theme by Anders Noren — Up ↑