python challenge (in ruby)