Chapter 15: Writing Large Programs

Example justify.c, Page 359 Other files- word.h, line.h, word.c, line.c

In [16]:
import textwrap
quote2=''
quote= ('  C   is quirky, flawed,    and an '
        'enormous success.     Although accidents of   history '
        ' surely  helped,   it evidently satisfied   a   need '
        ''
        'for  a   system  implementation   language   efficient '
        'enough    to   displace         assembly   language, '
        '  yet sufficiently   abstract   and fluent    to describe '
        ' algorithms  and    interactions   in a   wide    variety '
        'of    environments.'
        '                      -- Dennis     M.        Ritchie')
for i in quote:
    if (len(i)>20):
        i=(i[:20] + '*')
    quote2=quote2+i
quote2=' '.join(quote2.split()) """Python has inbuilt functions for removing 
white spaces and textwrap, justifying text hence reduces the amount of code as required in C"""
quotee= textwrap.fill(quote2)
print quotee
C is quirky, flawed, and an enormous success. Although accidents of
history surely helped, it evidently satisfied a need for a system
implementation language efficient enough to displace assembly
language, yet sufficiently abstract and fluent to describe algorithms
and interactions in a wide variety of environments. -- Dennis M.
Ritchie
In [ ]: