You forgot the colon at the end of the for/if header. This works: for p in range(2,10): if is_prime(2^p-1): print p, 2^p-1
Fabio On Sat, Jan 17, 2009 at 6:00 PM, A. Jorge Garcia <calcp...@aol.com> wrote: > > I'm really liking this Sage environment. So, I suppose its time to > learn some python. I tried the following code: > > for p in range(2,10) > if is_prime(2^p-1) > print p, 2^p-1 > > and got the error: > > Syntax Error: > if is_prime(2^p-1) > > what am I missing? > > TIA, > A. Jorge Garcia > calcp...@aol.com > http://calcpage.tripod.com > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-edu" group. To post to this group, send email to sage-edu@googlegroups.com To unsubscribe from this group, send email to sage-edu+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en -~----------~----~----~----~------~----~------~--~---