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!
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.