[Tutor] printing columns

Scot W. Stevenson scot@possum.in-berlin.de
Mon, 29 Jul 2002 11:58:56 +0200


Hello Chris,=20

just thought of another variant instead of my

> # find longest string
> longestLength =3D 0
> for item in menuItems:
>     x =3D len(item)
>     if x > longestLength:
>         longestLength =3D x

that is even shorter: =20

# find longest string
longestLength =3D 0
for item in menuItems:
    longestLength =3D max(len(item), longestLength)

The output seems to be the same...but I'm never sure about stuff like=20
memory use and speed...

Y, Scot


--=20
  Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany