Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can check if the variables are already in the dictionary provided by globals() and reject those who are:

sage: vars_to_test = {'a', 'b', 'c', 'E', 'I', 'z'}
sage: my_vars = [i for i in vars_to_test if i not in globals()]
sage: print(my_vars)
['a', 'c', 'z', 'b']

Then you can define the variables through

var(my_vars)