reg: playing with the list

Colin J. Williams cjw at ncf.ca
Fri Jun 24 10:09:47 EDT 2011


On 24-Jun-11 03:01 AM, kaustubh joshi wrote:
> Hey all,
> I am new here and new to python too. In general new to programming .
> I was working on aproblem.
> and need some help.
> I have a list of numbers say [2,3,5,6,10,15]
> which all divide number 30.
> Now i have to reduce this list to the numbers which are prime in number.
> i.e.
> [2,3,5]
> can somebody suggest?
> K
>

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

There was a recent discussion on this topic.

Colin W.




More information about the Python-list mailing list