Each prawn, new to python soon, could you tell me how to write the above logic?
Abcd for b and d, use the abcd circulation substitution, total cycle N layer, N
Law of the character after the sorting,
For example, the first layer is the abcd
The second will b and d are replaced by the abcd, get aabcdcabcd
As the third layer is to replace b and d with the abcd (no matter how many layers, both for the abcd), get aaabcdcaabcdcabcd
By analogy, to N layer only,
CodePudding user response:
Cycle then=3
S='abcd'
While n & gt; 0:
S=re. Sub (' [bd] ', 'abcd' s)
N -=1