For step 2 it says - "For each number n from 2 to x - 1, test if x is evenly divisible by n."

I presume this is intended for find the prime numbers dived it by every number except itself and by 1 but range(2,x) is already one below x. I am having trouble explaining this but what I am trying to show is that say x is 20 - range (2, 20) is already 2 - 19. Why subtract 1 from x?

# Why do they tell us to make range x-1 in is_prime

**stetim94**#2

you don't. range is already doing this substraction for you. You need the values 2 till x - 1, but range already doesn't include x, so the `x-1`

step is done for you by range

**system**#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.