You might try  writing the boolean function is_prime(n) for almost any n.

There was a recent discussion on this topic.

Since the guy is "new in programming", I complete the answer, just in case. Using the function is_prime(n),

FIRST POSSIBILITY :

new_list=[]
for n in old_list:
   if is_prime(n):
      new_list.append(n)

SECOND POSSIBILITY :

new_list=[ n for n in old_list if is_prime(n) ]



There is a primiality test in Sage which is basically a module over python (www.sagemath.org).

Have a good WE
Laurent
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to