code 1
display = []
for _ in range(2):
display += "_"
print(display)
concole output = [" _ ", " _ "]
code 2
dis = []
dis = dis + "_"
print(dis)
output on the console: can only concatenate a string to list
In the first code, I don't understand how concatenation yields the output results. But in the second code when the same thing is performed with no loop it gives the error as mentioned above.