The following lists are given: letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] numbers = [1, 2, 3, 4, 5, 6, 7, 8] What does the list below look like? chessboard = [''.join([i, str(j)]) for i, j in zip(letters, numbers)]

Questions & AnswersCategory: PythonThe following lists are given: letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] numbers = [1, 2, 3, 4, 5, 6, 7, 8] What does the list below look like? chessboard = [''.join([i, str(j)]) for i, j in zip(letters, numbers)]
Lokesh Kumar Staff asked 2 years ago

The following lists are given:

letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
numbers = [1, 2, 3, 4, 5, 6, 7, 8]

What does the list below look like?

chessboard = [''.join([i, str(j)]) for i, j in zip(letters, numbers)]

 
a. [(‘A’, ‘1’), (‘B’, ‘2’), (‘C’, ‘3’), (‘D’, ‘4’), (‘E’, ‘5’), (‘F’, ‘6’), (‘G’, ‘7’), (‘H’, ‘8’)]
b. [‘A1 B2 C3 D4 E5 F6 G7 H8’]
c. [‘A1B2C3D4E5F6G7H8’]
d. [‘A1’, ‘B2’, ‘C3’, ‘D4’, ‘E5’, ‘F6’, ‘G7’, ‘H8’]

1 Answers
Lokesh Kumar Staff answered 2 years ago

d. [‘A1’, ‘B2’, ‘C3’, ‘D4’, ‘E5’, ‘F6’, ‘G7’, ‘H8’]
 
Explanation:

str.join(iterable) – return a string which is the concatenation of the strings in iterable.