I'm trying to loop a list and unable to add it to the string in python

Solution 1:

You just need to iterate over the list and print text + the element in the loop.

In Python >= 3.6:

for e in res['bert'].split('\n'):
    print(f'{text} {e}?')