Skip to main content

Thread: Python lists


i have following function.
code:
def createfulllist(n, startweek):            oldweek = startweek      x in range(n-2):          tempone = oldweek[0]          oldweek.insert(-1, tempone)          del oldweek[0]          print (oldweek)          week[x] = (oldweek)
the n comes user entering number of teams, startweek comes function creates first list.

when run following error. week[x] = (oldweek)
indexerror: list assignment index out of range

need @ end of function list each week 1 number of teams - 1. therefore need week[1] = [1,2,3,4,5,6,7,8], week[2] =[2,3,4,5,6,7,1,8] , on week[7] = [7,1,2,3,4,5,6,8]. thats example if user inputs 8. know how rotation creating list of lists speak im stuck on.

you can do

code:
week.append(oldweek)


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Python lists


Ubuntu

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues