| about | help | code help+videos | done | prefs | 
| Write a function that takes an integer n as a parameter, and computes an n × n grid (list of lists) called H in which all cells on the main diagonal contain a 1 and the rest of the cells contain a 0. For example, if n = 5, your function should compute the grid [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]] diagonal(3) → [[1, 0, 0], [0, 1, 0], [0, 0, 1]] diagonal(4) → [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] diagonal(0) → [] ...Save, Compile, Run (ctrl-enter) | 
Progress graphs: 
 Your progress graph for this problem
 Random user progress graph for this problem 
 Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy