Second python solution