Lesson 2: Diamond and Left Oriented pattern using while loop

Code:
line = []
wline = []
max_length = 10
x="*"
y=" "
while len(line) <= max_length:
line.append(x)
wline.append(y)

i = 1
while i <= max_length:
x=wline[:-i]
y=line[:i]
print((x+y))
i = i+1
i = 2
while i <= max_length:
x=wline[:i]
y=line[:-i]
print(
(x+y))
i = i+1

When i run this the output prints the pattern for the left oriented triangle, BUT has spaces between the “*“which i can’t seem to get rid of. What can i change in the code?
Also if i change the value of y to y=”” i get diamond, does that count as accurate?

Regards,
Sid

You’re printing out the list (line and wline) that’s why there’s space between your stars. Try to use string and print string component, instead of list.