input: Write a python function to generate a list of prime numbers up to a given number.
  assert generate_primes(10) == [2, 3, 5, 7]
  assert generate_primes(50) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
  assert generate_primes(100) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
output: def generate_primes(n):
      if n < 2:
          return []
      primes = []
      for num in range(2, n + 1):
          is_prime = True
          for i in range(2, int(num ** 0.5) + 1):
              if num % i == 0:
                  is_prime = False
                  break
          if is_prime:
              primes.append(num)
      return primes