Added Python solution 4