Count Uppercase
Write the function count_uppercase(text)
that
counts the number of uppercase characters in text. The
parameter text is a string containing any characters
and of any length. The function should return the number of
uppercase characters in text
Test Cases
print('Input: "hElLo"\tActual: ', count_uppercase("hElLo"), '\tExpected: 2') print('Input: "HeLlO"\tActual: ', count_uppercase("HeLlO"), '\tExpected: 3')
Range
Write the function compute_range(numbers)
that
computes the range of a list of numbers. The
parameter numbers is a list of numbers that contains at
least one number. The function should return the difference
between the largest and the smallest number in numbers.
Test Cases
print('Input: [1, 2, 3, 4]\tActual: ', compute_range([1, 2, 3, 4]), '\tExpected: 3') print('Input: [1.5, 0.25, -1.5]\tActual: ', compute_range([1.5, 0.25, -1.5]), '\tExpected: 3.0')