Python Challenge - Prime Number Finder

def prime_finder(n):
  
  prime = []
  num_list = []
  
  for num in range(2, n + 1):
    for x in range(1, num + 1):
      if str(num / x)[-2:] == '.0':
        num_list.append(x)
    if len(num_list) == 2:
      prime.append(num)  
    num_list = []
  
  return prime
 
print(prime_finder(11))

I was nervous to post my code to the forum because I assumed that my answer was going to be overly complicated compared to others but it looks very similar to most of them! :grin:

I realize now I could’ve just used modulus to find the whole numbers from the division but oh well, this way is a tad bit different than most.

Thanks for highlighting the discrepancies in the prime_finder function and sharing your valuable insights. I’ll definitely investigate and work on finding an improved solution.