Define Alphanumeric variable in sage

30 views
Skip to first unread message

Abhishek Kesarwani

unread,
Sep 13, 2017, 1:26:04 PM9/13/17
to sage-support
How to define alphanumeric variable like x1 =1, x2 =2, ... xn =n ? using Loop.

Eric Gourgoulhon

unread,
Sep 13, 2017, 5:00:08 PM9/13/17
to sage-support
Something like

sage: for n in range(10):
....:     exec("x{} = {}".format(n, n))
....:

should do the job.

Eric.
Reply all
Reply to author
Forward
0 new messages