Mar-21-2019, 06:16 PM
(This post was last modified: Mar-21-2019, 06:31 PM by DreamingInsanity.)
Depending on an input ('a' or 'd') I would like to move a character left or right. I already have this:
When I run this code, new becomes: '1000004000001'. This is not the right length. It you use
Hope it makes sense,
Dream.
EDIT: removed dupe post lines
pos = line.index('4') pos = pos - 1 new = new + '1' for i in range(0, pos-1): new = new + '0' new = new + '4' for j in range(0, pos+1): new = new + '0' new = new + '1'FYI: Line is '100000040000001'
When I run this code, new becomes: '1000004000001'. This is not the right length. It you use
len()it returns '13' not '15' like the original. So it should be: '100000400000001' which is still 15 in length.
Hope it makes sense,
Dream.
EDIT: removed dupe post lines