I wrote a simple python script that creates a 7x7 list of dots '.', I want to change the diagonal to stars '*'.
Here is my script
n=7
l=['.']*n
m=[l]*n
for i in range(n):
for j in range(n):
if i==j:
m[i][j]='*'
print(*m[i])
Here is the output I get
* . . . . . .
* * . . . . .
* * * . . . .
* * * * . . .
* * * * * . .
* * * * * * .
* * * * * * *
I don't understand why I have such output, when I added an else statement it works fine.
Did I miss something ?