Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 4
    Because you call countDivisors() while declaring the class. Commented Aug 8, 2021 at 17:37
  • 1
    Does this answer your question? Order of execution and style of coding in Python Commented Aug 8, 2021 at 17:41
  • 1
    Given that the sole purpose of countDivisors() is to initialize a global variable (sieve), the call to it doesn't belong inside the Solution class at all - neither in the class body, nor in the __init__() method. The call to the function should be at the top level of your code, probably just after the definition of the function. Commented Aug 8, 2021 at 17:51