import os import os.path # I use "directory" for what you might call a "folder" # For floating point numbers, use close_enough(a,b) instead # of a == b to avoid floating-point error nightmares. # try testing your code in the main routine. def close_enough(a,b): """prec: a, b are floating-point numbers postc: tells if a and b are nearly equal""" return abs(a - b) < 1e-6 def extract_numbers(table_row): """prec: table_row is a string containing an HTML5 table row with integer data, which looks like this <tr><td>56</td><td>45</td><td>22</td></tr> (It can have arbitrarily many elemnts) postc: returns a list with the number in it. For the example that'd be [56, 45, 22]. Make sure they are numbers and not numeric strings""" pass def approximate_average(f, a, b, n): """prec: f is a numeric function defined on the interval [a,b] a < b, and n is a positive integer postc: returns the average of f evaluated at n + 1 equally-spaced points in [a,b]""" pass def find_arithmetic_sequence(num_list, k): """prec: num_list is a list of numbers postc: returns True if num_list contains an arithmetic progression length at least k example find_arithmetic_sequence([4,2,7,9,11,3,5], 3 -> True becaue 7, 9, 11 is an arithmetic sequence. """ pass def contains(search_string, file_name): """prec: search_string is a string file_name is an existing file post: returns True if the file contains the seach string""" pass def grip(search_string, file_name): """prec: search_string is a string file_name is a file name (that exists) postc: prints out all lines in the file containing the search string""" pass def make_a_list(file_name): """prec: file_name is an existing file containing space-separated rows of numbers. postc: returns a list of the numbers in the file in the order in which they are present""" def transform(file_name, old, new): """prec: file_name is an existing file old, new are strings. postc: produces a file with the name file_name + ".out" in which the contents of file_name have every instance of the string out replaced with the string new""" def spill(some_directory): """prec: some_directory is an existing directory postc: returns a list of the regular files in that direcory.""" def list_contents(some_directory): """prec: some_directory is a possibly existing directory. post: returns False if some_directory is a regular file or if some_directory does not exist. postc: returns a list of the regular files (not directories) in the directory otherwise""" pass