condition 1
- I have strings 'hello world joe'
- I need to add
*andorbetween them - Expected out >>
'*hello* or *world* or *joe*'
condition 2
There is exclusion list is there for adding * ['or', 'and' 'not']
If the input is
hello or world and joeExpected out >>
'*hello* or *world* and *joe*'
If any space ' ' or + is there then it has to add string or if and and not is coming between the string then no need to add * between them
Code is below for condition1 how to incorporate condition2 also
value = 'hello world joe'
exp = ' or '.join([f'*{word.strip()}*' for word in value.split(' ')])
print(exp)
exclusion_list = ['or', 'and', 'not']
andandnotis coming between the string then no need to add*between them". So should the result of'hello or world and joe'be'*hello* or *world* and *joe*'or'*hello* or *world* and joe'or'*hello* or world and joe'or...?