[Tutor] Strings.

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Oct 24 02:03:43 CEST 2012

On 24/10/2012 00:24, Nitin Ainani wrote:
> Dear Sir/Madam,
> I am  new to python I have a question. It is as follows:
> Suppose *s* is a variable and *s* stores empty string

Pythonistas prefer the use of name and not variable.

> s=""
> Now if we write following statement
> print(s[0])      # it gives error
> print(s[0:])    # it does not give error
> print (s[13:13])   # this too does not give erro
> why?

This was the design decision made by Guido van Rossum many, many years ago.

Other people have already given you other answers on the other thread 
that you started with the same question but a different subject, please 
don't do that, thanks.

> Regards,
> Nitin


Mark Lawrence.

More information about the Tutor mailing list