[Tutor] if you're interested in the code thus far...
Peter Otten
__peter__ at web.de
Sun Oct 26 11:52:46 CET 2014
Clayton Kirkwood wrote:
> for description_position, code_position in zip(description, code):
> description_position_len = len(description_position)
> current_output_pos += description_position_len
> if current_output_pos >= output_line_len:
> print(description_output_string)
> print(code_output_string)
> code_output_string=description_output_string=''
> current_output_pos=-1 #start new line
>
> description_output_string += '{:^}|'.format(description_position)
> code_output_string+='{0:^{1}}|'.format(code_position,
> description_position_len)
>
> current_output_pos+=1 #takes care of '|' at end of string
If you want to ensure that the actual line length is never more than
output_line_len -- the above doesn't do that.
Hint: reconsider this line:
> current_output_pos=-1 #start new line
> and a subset of output:
Some pairs are not printed. Can you figure out which and why?
More information about the Tutor
mailing list