May-21-2024, 07:21 AM
(This post was last modified: May-21-2024, 07:21 AM by Gribouillis.)
Once again, you don't post Python code which is what we'd like to see! As a consequence I won't post Python code either, but here is a reasonable informal algorithm
Output:prefix = empty
for each line:
if the prefix is empty or the line is empty:
prefix = line
print prefix and line
« We can solve any problem by introducing an extra level of indirection »