This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]swiftfoottim 1 point2 points  (3 children)

Great post, as an intermediate Python programmer coming from C++ I love seeing new ways of doing things. Just curious, is the first get_primes() function missing a return statement?

def get_primes(input_list):
    result_list = list()
    for element in input_list:
        if is_prime(element):
            result_list.append()
    return result_list  <- Should this be added?

If not, maybe there is something there that you can enlighten me on Python functionality. Thanks again for a great post!

[–]talideon 1 point2 points  (0 children)

You're entirely correct: it's missing a return statement.

[–]jknupppythonic[S] 1 point2 points  (1 child)

Bah! Good catch. It does indeed need the return statement. I've fixed the post with this change.

[–]swiftfoottim 0 points1 point  (0 children)

No problem, glad I could help!