Create a function in Python that prints out all prime numbers between 1 and a given number.
def print_primes(n):
  for num in range(2, n + 1):
      isPrime = True
      for i in range(2, num):
          if (num % i == 0):
              isPrime = False
      if isPrime:
          print(num)