inputlist module¶
-
class
inputlist.
InputList
(nums=None, sum=None, minmax=None, maxdiff=None)¶ -
calc_max_diff
()¶ Returns maximum difference between consecutive elements in input list
Parameters: self – list of n integers between -9,000 and 9,000
Returns: maximum difference d defined by d = self[i+1] - self[i] for i = 0 to n-1
Raises: - ImportError – If Numpy is not installed
- 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
-
calc_min_max
()¶ Returns min and max in a list
Parameters: self – (int) list to calc min and max of
Returns: min and max of list in a tuple
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
-
calc_sum
()¶ Returns the sum of a list
Parameters: self – list of n integers between -9,000 and 9,000
Returns: sum of all the n integers in the list
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
-
static
import_modules
()¶ Imports required module (Numpy)
Returns: the module Numpy
-
nums
¶
-