Brittney P.

# Need help trying with nested list problem

HI! I have a list of lists, and within the nested lists are tuples (representative of (x,y) coordinates). I want the nested lists to represent a bin.

list_of_list = [[(2,1),(4,2),(3,1)], [(1,1),(2,2),(4,3)]]

I want to separate the x-coordinates and the y-coordinates, but I each of the nested lists to be two different stacks of boxes (referring back to the two different bins). So, essentially, I want to plot the boxes

How can I make it resemble this:

x = [[2,4,3],[1,2,4]]

y = [[1,2,1],[1,2,3]]

I then want to create a .txt file of the coordinates. Specifically, when all the coordinates that are within the nested list are plotted, then the next value is shifted over. How can I do that do that within a loop?

Example of what I'm trying to do:

x1 = 0

y1 = 0

for i in x:?

for j in y:

**don't know the condition that would specify that the elements within the first nested list have to be stacked on top of one another

y1 = y1 + j

** don't know the condition that would specify that the elements within the first nested list have been plotted and must move to the second nested list where the starting location is shifted

x1 = x1 + x

## 2 Answers By Expert Tutors

By:

Tutor
New to Wyzant

Passionate Computer Scientist Tutor
4.7 (31)

Math and computer tutor/teacher

## Still looking for help? Get the right answer, fast.

Get a free answer to a quick problem.
Most questions answered within 4 hours.

#### OR

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.