Asrarahmed Kadri wrote: > Its something very close. > What I want is: > > 1 > 1 1 > 1 2 1 > 1 3 3 1 > 1 4 6 4 1 > > This can be done using arrays, right or is there any other way??
Is this a homework assignment? A list of lists seems like the appropriate way to represent this, especially since it is not actually a square array. Here is a simpler example that might give you some ideas: In [5]: b=[] In [6]: for i in range(5): ...: b.append(range(i)) ...: ...: In [7]: b Out[7]: [[], [0], [0, 1], [0, 1, 2], [0, 1, 2, 3]] Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor