listops module¶
-
exception
listops.
BadNumbersException
¶ Bases:
exceptions.Exception
-
class
listops.
ListOps
(l)¶ Class to perform several basic operations on lists of integers.
-
check_inputs
(l)¶ Checks if input list fits desired format
Parameters: l – list of n integers between -9,000 and 9,000
Raises: - TypeError – Input must be lists
- TypeError – Input elements must be integers
- ValueError – All input elements must be between -9,000 and 9,000 (inclusive)
- BadNumbersException – Numbers 123 and 321 cannot be in same list
-
get_max_diff
()¶ Returns maximum difference between consecutive elements in input list
Returns: maximum difference d defined by d = self.list[i+1] - self.list[i] for i = 0 to n-1
-
get_min_max
()¶ Returns min and max in a list
Returns: min and max of list in a tuple
-
get_sum
()¶ Returns the sum of a list
Returns: sum of all the n integers in the list
-
import_modules
()¶ Imports required module (Numpy)
Returns: the module Numpy
-
list
¶ List object for class
-