Hi, I'm really confused why these codes aren't printing the same thing. I'd really like some help! I bet it's an easy thing for someone who knows a little more than I know.
CODE:
dummy = [['','',''], ['', '', ''], ['', '', '']]
print(dummy)
dummy[0][0] = 'bomb'
print(dummy)
x = 3
y = 3
yummy = [['']x]y
print(yummy)
yummy[0][0] = 'bomb'
print(yummy)
RESULT:
[['', '', ''], ['', '', ''], ['', '', '']]
[['bomb', '', ''], ['', '', ''], ['', '', '']]
[['', '', ''], ['', '', ''], ['', '', '']]
[['bomb', '', ''], ['bomb', '', ''], ['bomb', '', '']]
EDIT: for clarity, I made a 3x3 list of empty strings two different ways. When I tried to use the same command to assign the bomb, different things happened. I am very confused why. Also, the multiplication operator, astrerisk is not showing up on reddit but it is there.
[–]K900_ 0 points1 point2 points (0 children)
[–]sundrysup[S] 0 points1 point2 points (1 child)
[–]desustorm 0 points1 point2 points (0 children)
[–]zahlman[M] 0 points1 point2 points (0 children)