Write a method in python to find and display the prime numbers between 2 to N. Pass N as an argument to the method.
def prime_numbers(N):
for I in range(2, N+1):
M = I // 2
IsPrime=1
for J in range(2, M+1):
if I % J == 0:
IsPrime=0
break
if IsPrime==1:
print(I)