[Tutor] learning to programming questions part 1

Danny Yoo dyoo at hashcollision.org
Wed Jun 25 03:05:42 CEST 2014


On Jun 24, 2014 4:55 PM, "keith papa" <keithadu at live.com> wrote:
>
> 1. Hi am new to python and I have a few questions:
> Why if you want to write multiple comment you use triple quotation marks
and not the #?
>

In certain places, string literals are treated as documentation that you
can access with the help() function.  Triple quotes are a way of writing a
strong literal.  Comments, on the other hand, are ignored: they don't
contribute to documentation.

> 2. I found this code to be interesting to me because it printed an output
of [1,2,3,4,5,6,7] and not [1,2,3,4:4,5,6,7] why is that?
>

What do you think the meaning of line two of the program is?  That is, what
do you think the following line means?

    a[4:4] = [5,6]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140624/27e4e4be/attachment.html>


More information about the Tutor mailing list