Everyone in the comments seems to agree that negative numbers aren't prime.
The definition given in the description: "Per Wikipedia, a prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself."
Is valid for negative numbers (e.g. -5 has divisors: 1, 5, -1, -5 i.e. the only positive divisors are 1 and itself), I think the language "positive divisors" makes it clear they're considering negative numbers here.
Regardless of what common usage is, I think the definition should match the test cases. Clarifying the definition would be an easy fix.
my test output is showing weird errors it says
75 not prime:true should equal false
4 not prime : true should equal false.this also happened for other numbers like 6 and 8...i mean 4,6,8and 75 are definitely not prime numbers pls fix this
OP solved it, closing
how to convert ("") to [""], other tests are passed
You're right! Not a close reading on my part.
Even if -5 was a natural number (which it isn't):
Is -5 a natural number? The definition you quoted mentions natural numbers. Are negative numbers such?
Everyone in the comments seems to agree that negative numbers aren't prime.
The definition given in the description: "Per Wikipedia, a prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself."
Is valid for negative numbers (e.g. -5 has divisors: 1, 5, -1, -5 i.e. the only positive divisors are 1 and itself), I think the language "positive divisors" makes it clear they're considering negative numbers here.
Regardless of what common usage is, I think the definition should match the test cases. Clarifying the definition would be an easy fix.
This comment is hidden because it contains spoiler information about the solution
would there be anyway i could send u the test output?
but the real issue here is my other tests are passed (for prime numbers) the test is considering non prime numbers as prime numbers
Your code is returning
True
instead ofFalse
for those numbers that aren't prime numbers, the tests are ok, your code is wrong.my test output is showing weird errors it says
75 not prime:true should equal false
4 not prime : true should equal false.this also happened for other numbers like 6 and 8...i mean 4,6,8and 75 are definitely not prime numbers pls fix this
ok thanks ✌️
objects and classes
OOP? Loops?
Anyway, you can use whatever tool you want, as long as it gets the job done.
Loading more items...