One option is: sage: def F(m): ....: return sum([(m*n+2 if m*n < 0 else m*n+8) for n in range(1, 10)]) sage: F(2) 162 sage: F(-2) -72
--Mike -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org