logo CodeStepByStep logo

jagged_list

Language/Type: Python 2D lists

Write a piece of code that constructs a jagged two-dimensional list of integers named jagged with five rows and an increasing number of columns in each row, such that the first row has one column, the second row has two, the third has three, and so on. The list elements should have increasing values in top-to-bottom, left-to-right order (also called row-major order). In other words, the list's contents should be the following:

1
2, 3
4, 5, 6
7, 8, 9, 10
11, 12, 13, 14, 15
Bare code: Write a fragment of Python code as described, without any class or function/method heading around your code.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.