'How to safe xyz coordinates into .las file format?

I am having issues saving a dataset of xyz coordinates (potentially with rgb colors) as a .las file. I looked and tried it with the laspy package but didn't get the hang of it. I also found this tutorial but it is sadly outdated. Any help, tips and/or explanation on how to do this would be great.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source