symbols =['a','b','c']
for i in range(len(symbols)):
formula= 'X~ age +' +symbols[i]+ '+'
print(formula)
This will give an output like:
X~ age+ a+
X~ age + b +
X~ age + c +
But I need the output to be :
X~ age+a
X~ age+a+b
X~ age +a +b+c