On Sat, Nov 18, 2017 at 2:29 AM, eth0 <ethernet.z...@gmail.com> wrote: > On Fri, 17 Nov 2017 00:04:16 +0000 in comp.lang.python, MRAB said: >> On 2017-11-16 18:47, jakub.raj...@gmail.com wrote: >> > Hello, im working on school project, its deck game Sorry! >> > I need to create specific lists: >> > My idea is about to using for >> > For i in range (n): >> > i=[] >> > I know, that there is no possibility to make it from number, but >> > i havent idea, how to reach my wants Li/L"i"/L(i), how to make >> > possible for lists? >> > >> > >> If you want multiple lists, make a list of lists: >> >> my_lists = [] >> >> for i in range(n): >> my_lists.append([]) >> >> Then you can say my_lists[0], my_lists[1], etc. > > It'd be even shorter using a list comprehension: > > my_lists = [[] for i in range(n)] > > And _even shorter still_ just using the multiply operator: > > my_lists = [[]] * n
Those are semantically different though. ChrisA -- https://mail.python.org/mailman/listinfo/python-list