[Tutor] Help

elie khairallah eliekhairallah1996 at gmail.com
Sat Mar 7 16:39:36 CET 2015


hello , I would like to know if theres a way to change a variable's name
after every iteration for example I want to make a function that stores a
number in x_1 if i=1 and in x_2 if i=2.
To be more precise:
i=1
def f(n):
       while i<n:
              x_i = i**2  ##this writing is wrong I would like here to have
x_1 or x_2 ...
                                     (depending on i)
        return (x_1,x_2,x_3 .....)


More information about the Tutor mailing list