reg: playing with the list

2011-06-24 Thread kaustubh joshi
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

Re: reg: playing with the list

2011-06-24 Thread Colin J. Williams
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

Re: reg: playing with the list

2011-06-24 Thread Laurent Claessens
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

Re: reg: playing with the list

2011-06-24 Thread Noah Hall
On Fri, Jun 24, 2011 at 8:01 AM, kaustubh joshi kandrjo...@gmail.com 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