I am trying to loop through a list of values and find out whether each number is either prime or composite and save it in the set under the function. The problem I am having is that it's not finding anything and it's just saving a running count of numbers. For example, this script is just saving all numbers from 1-19. I also understand that it's not actually saving the values in one set but I'll figure that out. Mostly need help on actually getting the values to be prime/composite.
def prime(num):
prime_set = set()
composite_set = set()
for i in range(2,num):
if num % i == 0:
composite_set.update([num])
else:
prime_set.update([num])
return(prime_set)
for num in range(1,20):
print(num,prime(num))