Iterating through a list passed as a parameter in python function
<p>I'm having trouble creating the correct algo, the correct code should meet the specs in the unit test, as follows:</p>

<p>Create a function get_algorithm_result to implement the algorithm below<br>
1. Get a list of numbers L1, L2, L3....LN as argument<br>
2. Assume L1 is the largest, Largest = L1<br>
3. Take next number Li from the list and do the following<br>
4. If Largest is less than Li<br>
5. Largest = Li<br>
6. If Li is last number from the list then<br>
7. return Largest and come out<br>
8. Else repeat same process starting from step 3</p>

<p>Create a function prime_number that does the following <br>
• Takes as parameter an integer and <br>
• Returns boolean value true if the value is prime or<br>
• Returns boolean value false if the value is not prime</p>

<p>The unit test is:</p>

<pre><code>import unittest

class AlgorithmTestCases(unittest.TestCase):
  def test_maximum_number_one(self):
    result = get_algorithm_result([1, 78, 34, 12, 10, 3])
    self.assertEqual(result, 78, msg="Incorrect number")

  def test_maximum_number_two(self):
    result = get_algorithm_result(["apples", "oranges", "mangoes", "banana", "zoo"])
    self.assertEqual(result, "zoo", msg="Incorrect value")

  def test_prime_number_one(self):
    result = prime_number(1)
    self.assertEqual(result, False, msg="Result is invalid")

  def test_prime_number_two(self):
    result = prime_number(78)
    self.assertEqual(result, False, msg="Result is invalid")

  def test_prime_number_three(self):
    result = prime_number(11)
    self.assertEqual(result, True, msg="Result is invalid")
</code></pre>

<p>I have tried all I can by coming up with this...</p>

<pre><code>def get_algorithm_result(list1=[1, 78, 34, 12, 10, 3]):
    max_index = len(list1) - 1

    for i in list1:
        max_num = i
        while max_num is i:
            if list1[list1.index(i) + 1] &gt; max_num:
                list1[list1.index(i) + 1] = max_num

                if list1.index(i) + 1 is max_index:
                    return max_num

            else:
                return max_num
        break

def prime_number(x):
    if x &gt; 1:
        for i in range(2, x + 1):
            if x % i == 0 and i != x and i != 1:
                return False
        else:
            return True
    else:
        return False
</code></pre>

<p>My error report is:</p>

<ol>
<li><p>test_maximum_number_one
Failure in line 11, in test_maximum_number_one self.assertEqual(result, 78, msg="Incorrect number") AssertionError: Incorrect number </p></li>
<li><p>test_maximum_number_two
Failure in line 15, in test_maximum_number_two self.assertEqual(result, "zoo", msg="Incorrect value") AssertionError: Incorrect value </p></li>
</ol>

<p>Anyone here, please help out. </p>

<p>Thanks</p>