For long enough I have used to print out a python list as below:

a = [1,2,3]
print(a)

Which is kind of working but without printing it in a nice format. So after experimenting I find a cleaner way to do it:

a = [1,2,3]
print(*a)

Tuple behave similarly:

a = (1,2,3)
print(a)

a = (1,2,3])
print(*a)

Conclusion

This brings us to the end of this article. Hope you like this Python trick.

‌If you liked this article, please consider subscribing to my blog. That way I get to know that my work is valuable to you and also notify you for future articles.‌
‌Thanks for reading and I am looking forward to hearing your questions :)‌
Stay tuned and Happy Machine Learning.


‌References