unmappend = unmarked.append
[(mappend(str(x)) if y else unmappend(str(x))) for x, y in d.items()]
print('Marked - %s\r\nUnmarked - %s' % (' '.join(marked), ' '.join(unmarked)))
How to print with inline if statement?