[Tutor] To FORMAT or not to

Alan Gauld alan.gauld at btinternet.com
Mon Jan 4 18:21:54 EST 2016


On 04/01/16 19:50, Mark Lawrence wrote:

> Three reasons for why it's better but it doesn't actually work as given.
> 
>  >>> island = "Isle Of Wight"
>  >>> new = "Isle of Wong"
>  >>> print("You've visited {0} & {2}.".format(island, new))
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> IndexError: tuple index out of range

Oops. That's what comes of using the OPs code and just
deleting the unnecessary markets. I forgot to change
the index. :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list