answered 2016-08-03 16:09:29 +0200
Your Python syntax is indeed wrong. It should be
sage: A=[n^2+n+m^2 for n in [1..100] for m in [0..41]]
The "and" keyword is reserved for the binary operation.