I just want to do something for transformation my string into view like: (2 ** 5)(5)(7 ** 2)(11), but my code works wrong. tell me please, where are my mistakes?!
values = [(2, 5), (5, 1), (7, 2), (11, 1)]
result = str(f'({i[0]}**{i[1]})' for i in values if i[1] != 1 else f'({i[0]})')
print(result) # (2 ** 5)(5)(7 ** 2)(11)