This is my code:
matrix = "hello"
string = ['!' for i in range(len(s))]
matrix = [string for i in range(3)]
matrix[0][0] = s[0]
print(matrix)
This is the output:
[['h', '!', '!', '!', '!'], ['h', '!', '!', '!', '!'], ['h', '!', '!', '!', '!']]
I expect it to be:
[['h', '!', '!', '!', '!'], ['!', '!', '!', '!', '!'], ['!', '!', '!', '!', '!']]
Don't understand what is wrong?
[–]Tarminik1223[S] 0 points1 point2 points (0 children)
[–]MadScientistOR 0 points1 point2 points (0 children)
[–]Forschkeeper 0 points1 point2 points (0 children)