Thanks for all the replies, it's much clearer now.
-Evan
--
http://mail.python.org/mailman/listinfo/python-list
It's quite straight forward, actually. What you need to know is that -1
is the index of the last element in a sequence, and that slicing
excludes the 'end' value in 'start:end'. So if you type arr[0:N], you
get the subsequence
[arr[0], arr[1], arr[2], ..., arr[N-1]]
When comparing with Matlab, P
Beliavsky wrote:
> Evan wrote:
>> In matlab I can do the following:
>>
ind = [3,5,7,2,4,7,8,24]
>> ind = 3 5 7 2 4 7 824
ind(1) ans = 3
ind(end) ans =24
ind([1 end]) ans = 324
>> but I can't get the last line in python:
Evan wrote:
> In matlab I can do the following:
>
> >> ind = [3,5,7,2,4,7,8,24]
> ind = 3 5 7 2 4 7 824
> >> ind(1) ans = 3
> >> ind(end) ans =24
> >> ind([1 end]) ans = 324
>
> but I can't get the last line in python:
>
> In [690]: ind =
"Evan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In matlab I can do the following:
>
>>> ind = [3,5,7,2,4,7,8,24]
> ind = 3 5 7 2 4 7 824
>>> ind(1) ans = 3
>>> ind(end) ans =24
>>> ind([1 end]) ans = 324
>
> but I can'
Evan wrote in news:[EMAIL PROTECTED] in
comp.lang.python:
> In matlab I can do the following:
>
>>> ind = [3,5,7,2,4,7,8,24]
> ind = 3 5 7 2 4 7 824
>>> ind(1) ans = 3
>>> ind(end) ans =24
>>> ind([1 end]) ans = 324
>
> but I can't get
In matlab I can do the following:
>> ind = [3,5,7,2,4,7,8,24]
ind = 3 5 7 2 4 7 824
>> ind(1) ans = 3
>> ind(end) ans =24
>> ind([1 end]) ans = 324
but I can't get the last line in python:
In [690]: ind = [3,5,7,2,4,7,8,24]
In [691]: ind