# I need to create a series of polygons from a list of lists that form a stair step shape

This code

Graphics[{Red, Polygon[{{0, 0}, {0, 10}, {1, 10}, {1, 0}}]}];
Graphics[{Blue, Polygon[{{1, 0}, {1, 9}, {2, 9}, {2, 0}}]}];
Graphics[{Green, Polygon[{{2, 0}, {2, 8}, {3, 8}, {3, 0}}]}];
Show[%, %%, %%%]


nicely creates what I need:

But, I need ten of them and it is tedious to do it one line at a time. For the corners, I tried NestList like this

NestList[{{# + 1, 0}, {# + 1, # - 1}, {# + 1, # - 1}, {# + 1,
0}} &, {{0, 0}, {0, 10}, {1, 10}, {1, 0}}, 3]


but that did not work.

Should have hung in a moment longer. Found this to work

NestList[{{#[[1, 1]] + 1,
0}, {#[[2, 1]] + 1, #[[2, 2]] - 1}, {#[[3, 1]] + 1, #[[3, 2]] -
1}, {#[[4, 1]] + 1, 0}} &, {{0, 0}, {0, 10}, {1, 10}, {1, 0}}, 3]


Still interested in better ways, though.

While others offer more compact code, here I favour strategies to keep a clean kernel, using scoping like Block to avoid leaving lingering definitions and which also gives you a single place to edit the relevant parameters like width, stepsize, etc...

Block[
{
width = 5,
stepsize = 1,
nBars = 10,
initialheight = 40,
height,
xposition
},
Graphics[
Table[
height=initialheight-stepsize*k;
xposition = width*k;
{
Directive[EdgeForm[Thin],Hue[0.9*k/(nBars-1)]],
Polygon[{
{xposition,0},
{xposition+width,0},
{xposition+width,height},
{xposition,height}
}]
}
,{k,0,nBars-1}]
]
]


cols = ColorData[97][#] & /@ Range[10]
polys = Table[Rectangle[{i, 0}, {1 + i, 10 - i}], {i, 0, 9}]
Graphics[{
Transpose[{cols, polys}]
}]


The color list can be changed as required.

step = Table[
Graphics[{Red,
Polygon[{{x1, 0}, {x1, 10 - x1}, {x1 + 1, 10 - x1}, {x1 + 1,
0}}]}], {x1, 0, 10}];

Show@Table[step[[ii]], {ii, 1, 11}]


Edit: to get different colors

polygons =
Table[Polygon[{{x1, 0}, {x1, 10 - x1}, {x1 + 1, 10 - x1}, {x1 + 1,
0}}], {x1, 0, 10}];
colors = # & /@ RandomColor[11];