Question:
Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in the i-th row and j-th column of the array should be i*j.

Note: i=0,1…. X-1; j=0,1…,­Y-1.

Also input is in a comma-separated form.

Program:

Explanation:

Range function generates a list of numbers, which is generally used to iterate over with for loops.

Output:

Do share your feedback in comments to help us adding more programs like this.

Checkout more Python Programs

Click here

Leave a Reply