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.

This exercise was taken from codingbat.com and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java.

Test 1

Input:

1
-1
False

Output:

True

Test 2

Input:

-1
1
False

Output:

True

Test 3

Input:

-4
-5
True

Output:

True

Test 4

Input:

-4
-5
False

Output:

False

Test 5

Input:

-4
5
False

Output:

True

Test 6

Input:

-4
5
True

Output:

False

Test 7

Input:

1
1
False

Output:

False

Test 8

Input:

-1
-1
False

Output:

False

Test 9

Input:

1
-1
True

Output:

False

Test 10

Input:

-1
1
True

Output:

False

Test 11

Input:

1
1
True

Output:

False

Test 12

Input:

-1
-1
True

Output:

True

Test 13

Input:

5
-5
False

Output:

True

Test 14

Input:

-6
6
False

Output:

True

Test 15

Input:

-5
-6
False

Output:

False

Test 16

Input:

-2
-1
False

Output:

False

Test 17

Input:

1
2
False

Output:

False

Test 18

Input:

-5
6
True

Output:

False

Test 19

Input:

-5
-5
True

Output:

True