def drawme_five(n):
a = [['.']*n]*n
for i in range(len(a)):
for j in range(len(a[i])):
if i == 0 or i == len(a)-1 or i == int(len(a)/2):
a[i][j] = '*'
if i < int(len(a)/2):
a[i][0] = '*'
elif i > int(len(a)/2):
a[i][len(a)-1]='*'
return a
I expected this code to give an output of a list of lists, where it with '.' and '*' in the form of number 5, but it gives me an output of all asterics. I don't know why the if statements don't work. If it works correctly, and we print one list each line, the output would be in a form of 5, for example if n = 5
- . . . .
. . . . *