Python multidimension problem

aim: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.
Suppose the following inputs are given to the program:
Then, the output of the program should be:
[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8]]

r=input("enter the no. of rows")
c=input("enter the no. of coloumns")
for i in range(0,x):
    for j in range(0,y):

pls help me out… there is an error at line 8
TypeError: ‘str’ object does not support item assignment

You get this error because of this:

You are initializing your list with a string.
Get rid of those quotes from your list and try again.

Hope this helps.

Just as the error message says, you can’t modify a string.

One approach, which will let you keep most of the code you’ve written, is to convert your string to a list of characters:

str = list(str)

Then join it back into a sting when you’re done:

str = "".join(str)