answer_1 = ('1', '2') answer_2 = ('3', '4') for i in range(1, 3): answer = f'answer_{i}' print(answer[0])
answer_1 = ('1', '2') answer_2 = ('3', '4') for i in range(1, 3): answer = f'answer_{i}' print(answer[0])
>>> answer_1 = ('1', '2') >>> answer_2 = ('3', '4') >>> for i in range(1, 3): ... answer = globals()[f'answer_{i}'] ... print(answer[0]) ... 1 3 >>>