Ask Your Question

# Create a set of numbers with a equatation and 2 diffrent variables

I need to create a set of numbers which are defined by m in [0..41] and n in [100]. The new created set needs to contain all the numbers which fulfill that condition.

I tried to accomplish that with:

A=[n^2+n+m^2 for n in [1..100] and m in [0..41]]

But Sage takes the and as an bool value not as another condition. can you help me with that?

(First time programming and english is not my mother tongue. Please be pleasefull)

Thanks alot!

edit retag close merge delete

## 1 answer

Sort by ยป oldest newest most voted

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.

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2016-08-03 08:36:49 -0500

Seen: 30 times

Last updated: Aug 03 '16