Thread: Python lists
i have following function.
the n comes user entering number of teams, startweek comes function creates first list.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)
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
Post a Comment