Hi,

I'm not too sure what your asking here,

your code assigns the following to endings:
['st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th',
'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st', 'nd', 'rd', 'th',
'th', 'th', 'th', 'th', 'th', 'th', 'st']

This is what we would expect.. 17 * ['th'] causes 17 repetitions of 'th' in
the list.
certain operators, like the multiplication operator in your example, have
additional behavior depending on what kind of data they are applied to.

The repetition operator binds closer than the '+' as the following brackets
show.

endings = ['st', 'nd', 'rd'] + (17 * ['th']) + ['st', 'nd', 'rd'] + (7 *
['th']) + ['st']

Ian.

On 9/4/07, chinni <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> i had some doubt about this line  can any body clarify this plz.......
> endings = ['st', 'nd', 'rd'] + 17 * ['th'] + ['st', 'nd', 'rd'] + 7 *
> ['th'] + ['st']
>
> --
> Best Regards,
> M.Srikanth Kumar,
> Jr.Software Developer,
> Google India Pvt Ltd..,
> HYDERABAD.
> Phone no: +91-9866774007
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to