Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isPrime bug #3

Open
deimi opened this issue Sep 4, 2022 · 2 comments
Open

isPrime bug #3

deimi opened this issue Sep 4, 2022 · 2 comments

Comments

@deimi
Copy link

deimi commented Sep 4, 2022

This function

returns True for the numbers 4, 6 and 8 despite that those are not prime numbers

@jablka
Copy link

jablka commented Nov 20, 2022

Yes, in module primes.py, in line 3:
instead of range(2, int(n**0.5)) should be probably: range(2, int(n**0.5)+1)
Not that I knew it, I just checked other codes on internet :)
And also the function should probably check if n > 1.

@alexepperly
Copy link

Yes, in module primes.py, in line 3:

instead of range(2, int(n**0.5)) should be probably: range(2, int(n**0.5)+1)

Not that I knew it, I just checked other codes on internet :)

And also the function should probably check if n > 1.

I think this is actually fixed in the files on GitHub, not the exercise files from the LIL site though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants