Chào cả nhà,
Mình có dòng code Python sau đây.
squares = ['orange', 'orange', 'purple', 'blue ', 'orange']
new_squares = []
i = squares[0]
while i=='orange':
new_squares.append(squares[i])
i +=1
print(new_squares)
Lỗi báo
TypeError: list indices must be integers or slices, not str
Không biết mình sai chỗ nào?
Xin cảm ơn đã xem bài.