l = ['a','b']
Output > the elements in list are '%a','%b'
l = ['a','b','c']
Output > the elements in list are '%a','%b','%c'
Like for any number of elements we need to add the elements in the list are and also with express with percentage %
l = ['a','b']
Output > the elements in list are '%a','%b'
l = ['a','b','c']
Output > the elements in list are '%a','%b','%c'
Like for any number of elements we need to add the elements in the list are and also with express with percentage %
You can use f-strings and join. 
sub_str = ", ".join(f"'%{e}'" for e in l)
print(f"the elements in the list are {sub_str}")
