语法练习:pos_neg
题目:pos_neg
Given 2 int values, return True if one is negative and one is positive. Except if the parameter “negative” is True, then return True only if both are negative.
pos_neg(1, -1, False) → True
pos_neg(-1, 1, False) → True
pos_neg(-4, -5, True) → True
我的解答:
def pos_neg(a, b, negative):
if negative:
return (a < 0</