View Single Post
Old May 3rd, 2008, 2:29 PM   #1
Chuckiferd
Programmer
 
Join Date: Nov 2007
Posts: 64
Rep Power: 1 Chuckiferd is on a distinguished road
Are nested lists indestructable?

Hello I am trying to create a program that involves writing a whole bunch of lists with information of its specific topic then grouping them together. Normally I would use a hash but they don't really let you create a whole bunch of variables that can be withdrawn later.

So my problem is when I nest them together, based on a random factor I want to delete so many of them from the back, but nothing I write seems to work

I can see doing all this with a whole bunch of if: loops but I know there has to be some easier way

here is my program(at least the part that pertains to it)
(PS. all the importing and preperations are done I simply didn't print it)

a=randint(6,11)
aa=['name', 'att', 'def', 1]
ab=['name', 'att', 'def', 1]
ac=['name', 'att', 'def', 1]
ad=['name', 'att', 'def', 1]
ae=['name', 'att', 'def', 1]
af=['name', 'att', 'def', 1]
ag=['name', 'att', 'def', 1]
ah=['name', 'att', 'def', 1]
ai=['name', 'att', 'def', 1]
aj=['name', 'att', 'def', 1]
abspirlist=[aa,ab,ac,ad,ae,af,ag,ah,ai,aj]
del abspirlist[a:]
shuffle(abspirlist)
__________________
There are 10 kinds of people in this world, those who can read binary and those who can't.
Chuckiferd is offline   Reply With Quote