On Sun, Jan 3, 2016 at 8:59 AM, <cc.fezer...@gmail.com> wrote: > Thanks Chris! > Don't worry about the indent, will fix it > I've rewritten it to this- > > def get_algorithm_result( numlist ): >> largest = numlist[0] >> i = 1 >> while ( i < len(numlist) ): > i = i + 1 >> if ( largest < numlist[i]): >> largest = numlist[i] >> numlist[i] = numlist[-1] >> numlist = [1,2,3,4,5] > return largest
This is even harder to read than before since some of the lines are now quoted and some are not. >> def prime_number(x): >> return len([n for n in range(1, x + 1) if x % n == 0]) <= 2 > > But it still gives the test_maximum_number_one error. > Please if you have any ideas what else I should change or add, let me know. > Thanks! It's hard to give any specific advice about fixing the unittest failure without knowing what the test is testing. These two lines don't seem to have anything to do with the algorithm that you quoted in the first post, however: > numlist[i] = numlist[-1] > numlist = [1,2,3,4,5] It looks like you should kill everything in this function after the assignment to largest and then start reimplementing the algorithm again from the " If Li is last number from the list" step. -- https://mail.python.org/mailman/listinfo/python-list