Open deimi opened 2 years ago
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
.
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.
This function
https://github.com/LinkedInLearning/python-essential-training-2449125/blob/8697180e48dcfb80d37d09726097689e7c9f4d4f/exercise_files/11_02_e/primes.py#L2
returns True for the numbers 4, 6 and 8 despite that those are not prime numbers