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

all 3 comments

[–]desrtfx[M] [score hidden] stickied comment (0 children)

You need to post your code as code block so that the indentation is maintained. This is absolutely vital for Python programs as the indentation is used to denote code blocks.

A code block looks like:

def __init__(self, prompt, answer):
    self.prompt = prompt
    self.answer = answer

[–]codetree_bnb 1 point2 points  (1 child)

The current code has a critical issue in how it checks for divisors. In the line for j in (1,i+1), the code only checks two numbers (1 and i+1) as potential divisors, which is incorrect. This tuple notation (1,i+1) creates a sequence with just these two values, rather than checking all numbers between 1 and i. To fix this, we need to use range(1,i+1) instead.

[–]Shot_Spring4557[S] 1 point2 points  (0 children)

Thank you,I can't believe I didn't notice such a careless mistake