List Indexing This part ol the lab introduces indexing lists You s...

Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import unittest
import filter

class TestCases(unittest.TestCase):
def assertListAlmostEqual(self, l1, l2):
self.assertEqual(len(l1), len(l2))
for el1, el2 in zip(l1, l2):
self.assertAlmostEqual(el1, el2)

def test_are_positive_1(self):
L = [1,9,-2,9,-12,3]
L_are_positive = filter.are_positive(L)
self.assertListAlmostEqual(L_are_positive, [1,9,9,3])

def test_are_positive_2(self):
L = [-1,-4,-6]
L_are_positive = filter.are_positive(L)
self.assertListAlmostEqual(L_are_positive, [])

def test_are_positive_3(self):
L = [2,4,5,1,2]
L_are_positive = filter.are_positive(L)
self.assertListAlmostEqual(L_are_positive, [2,4,5,1,2])

def test_are_greater_than_n_1(self):
L = [1,9,-2,9,-12,3]
L_are_greater_than_n = filter.are_greater_than_n(L,2)
self.assertListAlmostEqual(L_are_greater_than_n, [9,9,3])

def test_are_greater_than_n_2(self):
L = [10,12,19,13,2]
L_are_greater_than_n = filter.are_greater_than_n(L,5)
self.assertListAlmostEqual(L_are_greater_than_n, [10,12,19,13])

def test_are_greater_than_n_3(self):
L = [1,-12, 3, -8, -17]
L_are_greater_than_n = filter.are_greater_than_n(L,-10)
self.assertListAlmostEqual(L_are_greater_than_n, [1,3,-8])

def test_are_dividable_by_1(self):
L = [1,9,-2,9,-12,3]
L_are_dividable_by_n = filter.are_dividable_by_n(L,3)
self.assertListAlmostEqual(L_are_dividable_by_n, [9,9,-12,3])

def test_are_dividable_by_1(self):
L = [1,9,-2,9,-12,3]
L_are_dividable_by_n = filter.are_dividable_by_n(L,3)
self.assertListAlmostEqual(L_are_dividable_by_n, [9,9,-12,3])

def test_are_dividable_by_2(self):
L = [11,56,14,8]
L_are_dividable_by_n = filter.are_dividable_by_n(L,3)
self.assertListAlmostEqual(L_are_dividable_by_n, [])...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

\$35.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.