[Tutor] printing columns
Scot W. Stevenson
scot@possum.in-berlin.de
Mon, 29 Jul 2002 11:48:01 +0200
Hello Chris,=20
Just curious - there any reason you used
> # find longest string
> i =3D 0
> longestLength =3D len(menuItems[i])
> while i < len(menuItems):
> =09x =3D len(menuItems[i])
> =09i =3D i + 1
> =09if x > longestLength:
> =09=09longestLength =3D x
instead of something like
# find longest string
longestLength =3D 0
for item in menuItems:
x =3D len(item)
if x > longestLength:
longestLength =3D x
which seems to do the same thing with less indexing?
Y, Scot
--=20
Scot W. Stevenson -- scot@possum.in-berlin.de -- Zepernick, Germany