open book lot
Photo by Patrick Tomasso on Unsplash

If 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:

However, you are probably ever of a trick that you can do in Python: Multiply the string with a number and see the concatenation or the repetition of the string in that way:

Now, when it comes to lists, you may need to find the union of a list with itself, or simply repeat a list multiple times.

As you can probably guess by now, you can actually do that using the same trick you used for the repetition of strings:

That’s a hidden gem right there that you may have not stumbled upon in the past, right?

Yes, I also managed to find out about it only recently too.

I hope you find it useful.