[Tutor] indexing elements

Kent Johnson kent37 at tds.net
Tue Sep 4 03:38:38 CEST 2007


chinni 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']

You can try it in the interactive interpreter:
In [8]: endings = ['st', 'nd', 'rd'] + 17 * ['th'] + ['st', 'nd', 'rd'] 
+ 7 * ['th'] + ['st']
In [10]: print 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']

Kent


More information about the Tutor mailing list