Thanks a lot Leonhard

The code was ok when I ran but still did not pass the test according to the picture below

kindly help me we this.

.

# Python Syntax

ok thanks. I will just take it from here

Well `Li`

does probably mean current ListIndex so instead of using Li you might use your couting variable `i`

that goes through your list. Also where does this come from and what does it have to do with your function?

Create a function prime_number that does the following

Takes as parameter an integer and

Returns boolean value true if the value is prime or

Returns boolean value false if the value is not prime

```
largest = listNumb[0]
for i in range(1, len(listNumb)):
if largest < listNumb[i]:
largest = listNumb[i]
continue
return largest ```
```

You are not using indentations… and these are very important…

Please re-edit your Post

- leave one blank-line above of your code
- select your code in the Post
- then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state

and you will be able to make/present the proper indentations.

or even better use

= http://discuss.codecademy.com/t/using-backticks-to-format-your-code/3697

[extra’s]

https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

this will work fine

def get_algorithm_result(n):

if type(n) == type():

largest = n[0]

for item in n:

if largest < item:

largest = item

return max(n)

else:

pass

return largest

def prime_number(integer):

if integer%2==0 and 2!=integer:

return False

else:

return True

I have a problem with this codes

it does not want to run

Here is the question

Create both a recursive function called recursive_factorial and iterative function called iterative_factorial that does the following

Accepts as parameter an Integer n

Computes the factorial of n

Returns the factorial of n

import unittest

class RecursiveTestCase(unittest.TestCase):

def test_recursive_factorial_one(self):

result = recursive_factorial(4)

self.assertEqual(result, 24, msg=“Inaccurate value”)

def test_recursive_factorial_two(self):

result = recursive_factorial(0)

self.assertEqual(result, 1, msg=“Inaccurate value”)

def test_iterative_factorial_one(self):

result = iterative_factorial(5)

self.assertEqual(result, 120, msg=“Inaccurate value”)

def test_iterative_factorial_two(self):

result = iterative_factorial(0)

self.assertEqual(result, 1, msg=“Inaccurate value”)

def recursive_factorial(n):

if n == 0:

return 1

else:

return n * recursive_factorial(n-1)

def recursive_factorial(n):

def iterative_factorial(n):

def iterative_factorial(n):

what should i do

where is your function?

What do you mean? This is post is older than 3 weeks and it was a question to the OP.

def recursive_factorial (n):

if n == 0:

return 1

else:

return n *recursive_factorial(n-1)

def iterative_factorial (n):

result = 1

for i in range(1,n+1):

result *= i

return result

expectation = true

this was the 0ne i did but it keeps on showing this error maximum recursion depth exceded is the code wrong

pls help me review it if there is any error there

please help me on this code it is giving a lot of headache

hi bro!

I believe you have done Quiz 5 (Algo Lab). please help a brother here o, i have tried different method to write the code even when the test certify it…Ok, it still complains about spec

please help post it here.

Thanks

`def get_algorithm_result(n):

if type(n) == type():

largest = n[0]

for item in n:

if largest < item:

largest = item

return max(n)

else:

pass

return largest

def prime_number(integer):

if integer%3==0 and3!=integer:

return False

else:

return True

this is the answer and aiso indent it

Thank you, it works perfectly

Hi @designninja41379 did you ever get a “An error occurred running your script” when answering questions in the ALGO LAB?

this is my code and i keep getting that error message.

def get_algorithm_result(num_list):

if type(num_list) == type() and num_list != :

largest = num_list[0]

n = 0

while (n+1) < len(num_list):

if largest < num_list[n+1]:

largest = num_list[n+1]

n = n + 1

return largest

else:

pass

def get_algorithm_result(n):

if type(n) == type():

largest = n[0]

for item in n:

if largest < item:

largest = item

return max(n)

else:

pass

return largest

def prime_number(integer):

if integer%3==0 and3!=integer:

return False

else:

return True

the above code didnt work for me and i am stuck

is there anything i’m missing?

please help me. My deadline is in 2 days

def get_algorithm_result(n):

if type(n) == type():

largest = n[0]

for item in n:

if largest < item:

largest = item

return max(n)

else:

pass

return largest

def prime_number(integer):

if integer%3==0 and3!=integer:

return False

else:

return True

the above code didnt work for me and i am stuck

is there anything i’m missing?

please help me. My deadline is in 2 days

I have try the above code yet I still get an error could someone help me out please

guess we are both in the same boat:

can you work around this?

def get_algorithm_result(num_list):

largest =num_list[0]

for item in range(0,len(num_list)):

if largest < num_list[item]:

largest = num_list[item]

return largest

def prime_number(integer):

if integer%2==0:

return False

else:

return True

it didnt run, both my error was reduced, guess i need a way to work around the integer%2==0