We’re getting pretty close to a playable board, but wouldn’t it be nice to get rid of those quote marks and commas? We’re storing our data as a list, but the player doesn’t need to know that!
letters = ['a', 'b', 'c', 'd'] print " ".join(letters) print "---".join(letters)
- In the example above, we create a list called
- Then, we print
a b c d. The
.joinmethod uses the string to combine the items in the list.
- Finally, we print
a---b---c---d. We are calling the
.joinfunction on the
We want to turn each row into
"O O O O O".
Inside your function, inside your
for loop, use
" " as the separator to
.join the elements of each