def get_ordered_pair(ordered_pair_num, xs, ys): x = 0 y = 0 while (x is not None and y is not None): x = input("x for point #" + str(ordered_pair_num) + "(sbm): ") if (x == ""): print("Got empty, quitting...") main.page1() elif (x != ""): if (x == "sbm"): if ((xs == []) or (ys == [])): print("Submission can't be empty") get_ordered_pair(ordered_pair_num, xs, ys) answer = find_domain_range_ordered(xs, ys) x = None y = None break elif (RepresentsFloat(x)): print("Loading...") elif (any(c.isalpha() for c in x)): print("Must be a number!") get_ordered_pair(ordered_pair_num, xs, ys) y = input("y for point #" + str(ordered_pair_num) + ": ") if (y == ""): print("y cannot be empty") get_ordered_pair(ordered_pair_num, xs, ys) elif (y != ""): if (RepresentsFloat(y)): print("loading...") ordered_pair_num += 1 elif (any(c.isalpha() for c in x)): print("Must be a number!") get_ordered_pair(ordered_pair_num, xs, ys) xs += x ys += y return answer
def test_solve_pythagorean_03(self, mocked_input): mocked_input.side_effect = ['5', 'c', '6.7082', '2.00001'] self.assertEqual(main.page1(), 'c ≈ 7.0')
def test_solve_pythagorean_02(self, mocked_input): mocked_input.side_effect = ['5', 'b', '6.7082', '7'] self.assertEqual(main.page1(), 'b ≈ 2.0')
def test_solve_pythagorean_01(self, mocked_input): mocked_input.side_effect = ['5', 'a', '2', '7'] self.assertEqual(main.page1(), 'a ≈ 6.71')
def test_simplify_fraction_01(self, mocked_input): mocked_input.side_effect = ['1', '3', '7'] self.assertEqual(main.page1(), '3/7')
def test_find_dr_ordered_pair_02(self, mocked_input): mocked_input.side_effect = [ '4', '2', '1', '2', '3', '4', '3', '2', '4', '4', 'sbm' ] self.assertEqual(main.page1(), 'Domain: 1, 3, 4\nRange: 2, 4')
def test_solve_linear_func_03(self, mocked_input): mocked_input.side_effect = ['3', 'a', '4', '4', '13'] self.assertEqual(main.page1(), 'a(4)= 29')
def test_solve_linear_func_02(self, mocked_input): mocked_input.side_effect = ['3', 'g', '23', '1', '2'] self.assertEqual(main.page1(), 'g(1)= 25')
def test_solve_linear_func_01(self, mocked_input): mocked_input.side_effect = ['3', 'f', '1', '2', '3'] self.assertEqual(main.page1(), 'f(2)= 5')
def test_factor_quadratic_03(self, mocked_input): mocked_input.side_effect = ['2', '1', '2', '3'] self.assertEqual(main.page1(), 'Solutions are imaginary')
def test_factor_quadratic_02(self, mocked_input): mocked_input.side_effect = ['2', '1', '99', '23'] self.assertEqual(main.page1(), 'No factorization')
def test_factor_quadratic_01(self, mocked_input): mocked_input.side_effect = ['2', '1', '5', '4'] self.assertEqual(main.page1(), '(1x+1)(1x+4)')
def test_simplify_fraction_04(self, mocked_input): mocked_input.side_effect = ['1', '5', '0'] self.assertEqual(main.page1(), 'Division by 0 - result undefined')
import main main.page1()