On Apr 4, 3:19 pm, "Scott" <[EMAIL PROTECTED]> wrote:

(snipped)

>
> print
> print ' ' * left_margin + '+'   + '-' * (box_width-2)  +  '+'
> print ' ' * left_margin + '|  ' + ' ' * text_width     + ' |'
> print ' ' * left_margin + '|  ' + ' '   sentence       + ' |'
> print ' ' * left_margin + '|  ' + ' ' * text_width     + ' |'
> print ' ' * left_margin + '+'   + '-' * (box_width-2)  + ' |'
> print
>
> ****end code****
>
> Now that, even though copied straight from "Beginning Python: From Novice to
> Professional", returns :
> There's an error in your program: invalid syntax
>

(snipped)


Others have pointed out the mistake.  I'll just add that in
this particular case, one might want to pad lines with some
whitespace and change the middle print statement to:

print
print ' ' * left_margin + '+' +     '-' * box_width          + '+'
print ' ' * left_margin + '|' +     '-' * box_width          + '|'
print ' ' * left_margin + '|' +  sentence.center(box_width)  + '|'
print ' ' * left_margin + '|' +     '-' * box_width          + '|'
print ' ' * left_margin + '+' +     '-' * box_width          + '+'

to improve legibility.

--
Hope this helps,
Steven

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to