PHP and python 3 solutions with tests