big_diff

Given a list length 1 or more of ints, return the difference between the largest and smallest values in the list. Note: the built-in Math.min(v1, v2) and Math.max(v1, v2) methods return the smaller or larger of two values.

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:

[10, 3, 5, 6]

Output:

7

Test 2

Input:

[7, 2, 10, 9]

Output:

8

Test 3

Input:

[2, 10, 7, 2]

Output:

8

Test 4

Input:

[2, 10]

Output:

8

Test 5

Input:

[10, 2]

Output:

8

Test 6

Input:

[10, 0]

Output:

10

Test 7

Input:

[2, 3]

Output:

1

Test 8

Input:

[2, 2]

Output:

0

Test 9

Input:

[2]

Output:

0

Test 10

Input:

[5, 1, 6, 1, 9, 9]

Output:

8

Test 11

Input:

[7, 6, 8, 5]

Output:

3

Test 12

Input:

[7, 7, 6, 8, 5, 5, 6]

Output:

3