add much shorter solution in python