예제 #1
0
def main():
    # Question 1
    sol1 = create_array()
    print 'The 2-D array is \n', sol1.array
    print '\n'
    print 'The new array for question 1a is \n', sol1.picking_row()
    print '\n'
    print 'The new array for question 1b is \n', sol1.picking_column()
    print '\n'
    print 'The new array for question 1c is \n', sol1.picking_section()
    print '\n'
    print 'The new array for question 1d is \n', sol1.picking_range()
    print '\n'

    # Question 2
    print 'The array for question 2 is \n', divide_array()
    print '\n'

    # Question 3
    generate_randArray()
    print '\n'

    # Question 4
    candidate_set = mandelbrot(500)
    candidate_set.mandelbrot_iter()
    candidate_set.form_mask()
예제 #2
0
def main():
    # Question 1
    sol1 = create_array()
    print 'The 2-D array is \n', sol1.array
    print '\n'
    print 'The new array for question 1a is \n', sol1.picking_row()
    print '\n'
    print 'The new array for question 1b is \n', sol1.picking_column()
    print '\n'
    print 'The new array for question 1c is \n', sol1.picking_section()
    print '\n'
    print 'The new array for question 1d is \n', sol1.picking_range()
    print '\n'

    # Question 2
    print 'The array for question 2 is \n', divide_array()
    print '\n'

    # Question 3
    generate_randArray()
    print '\n'

    # Question 4
    candidate_set = mandelbrot(500)
    candidate_set.mandelbrot_iter()
    candidate_set.form_mask()
예제 #3
0
파일: test.py 프로젝트: yd604/assignment7
    def test_divide_array(self):
        ans = divide_array()

        # correct answer for some elements in the array calculated manually
        correct_cordinate_1_2 = 1.4
        correct_cordinate_4_3 = 1.15

        self.assertEqual(correct_cordinate_1_2,ans[1,2])
        self.assertEqual(correct_cordinate_4_3,ans[4,3])
예제 #4
0
    def test_divide_array(self):
        ans = divide_array()

        # correct answer for some elements in the array calculated manually
        correct_cordinate_1_2 = 1.4
        correct_cordinate_4_3 = 1.15

        self.assertEqual(correct_cordinate_1_2, ans[1, 2])
        self.assertEqual(correct_cordinate_4_3, ans[4, 3])