The code works perfect.
I wonder, even if i write (x - 1) or just x when representing the range function both of them works perfect in either case.
To my knowledge,
lets suppose x = 10
range(2, x) will give (2,3,4,5,6,7,8,9)
and range (2, x - 1) will give (2,3,4,5,6,7,8)
then why does everyone mentions x - 1 when i try to go through all the solutions to cross check. Thanks for the help in advance.
def is_prime(x): if x >= 2: for n in range(2, x - 1): if x % n == 0: return False else: return True else: return False