Search the difference: Why this function defenition does'nt work?
husam
h.jehadalwan at student.kun.nl
Sun Dec 23 04:08:49 EST 2001
Luke wrote:
> If you use a list index [0] that returns a single element of the type
> that that element is (which is what you want in this case). But when
> you use the colon for slice notation, you are asking python to return a
> tuple of all the elements up to the zeroth element, which is no
> elements--an empty tuple. Then you are trying to add a number to a
> tuple which is undefined.
>
But when I adjust the code to this:
sum=['c']
it still does not work, despite the fact that sum is not an undefined
object, right?
More information about the Python-list
mailing list