Arrays are fundamental in JavaScript, and two handy operators, spread and rest, can supercharge your array of manipulation skills. In this quick guide, we’ll dive into these operators and show you how they can simplify your code.
Continue readingTag: array
Lists are used pretty much all over the place in Python and in other programming languages as well.
Checking whether they have elements or not represents something that you may need to do.
One interesting thing about Python is that it allows you to do the same thing in more than just one way, as we can see in this case.
Continue readingIf you need to find the longest string in a list in Python, you may be tempted to do that in the form of iterating through every element, finding their length, and checking whether this current length is larger than a temporary value that we have chosen in the beginning.
Continue readingMost of the time you are adding elements into a list, or set, or a dictionary. However, there can also be cases when you just need to remove elements. Maybe a particular element, or even all elements at once.
If that is the case, then there is a quick method in Python that you can use to do that.
Continue readingLists are part of typically every project that you work on these days. You have lists of people, a list of products, a list of activities, and the list of lists goes on.
There can be times when you want to only have unique elements in that list, for example, if someone has liked multiple posts and you want to get all the people who have liked one of your posts. You do not want to include that same person multiple times in that list.
Continue reading