[Tutor] indexing elements

Alan Gauld alan.gauld at btinternet.com
Tue Sep 4 10:54:27 CEST 2007


"chinni" <srikanth007m at gmail.com> wrote
>
> 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']

Using the interpreter:

>>> endings = ['st', 'nd', 'rd'] + 17 * ['th'] + ['st', 'nd', 'rd'] + 
>>> 7 * ['th'] + ['st']
>>> 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']


What are your doubts?

Alan G. 




More information about the Tutor mailing list