First time here? Check out the FAQ!
answered 8 years ago
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.