Re: how to get INDEX count, or last number of Index

2018-05-24 Thread bartc
On 24/05/2018 03:37, Terry Reedy wrote: On 5/23/2018 8:46 PM, bartc wrote: On 24/05/2018 00:44, Terry Reedy wrote: On 5/23/2018 5:56 PM, Rob Gaddi wrote: On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, U

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread Terry Reedy
On 5/23/2018 8:46 PM, bartc wrote: On 24/05/2018 00:44, Terry Reedy wrote: On 5/23/2018 5:56 PM, Rob Gaddi wrote: On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, Use -1, which is the same as len(s)-1 but

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread Cameron Simpson
On 23May2018 23:14, Mark Lawrence wrote: On 23/05/18 22:56, Rob Gaddi wrote: On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a function that gives me last number of index Not sure

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread bartc
On 24/05/2018 01:46, bartc wrote: On 24/05/2018 00:44, Terry Reedy wrote: On 5/23/2018 5:56 PM, Rob Gaddi wrote: On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, Use -1, which is the same as len(s)-1 but f

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread bartc
On 24/05/2018 00:44, Terry Reedy wrote: On 5/23/2018 5:56 PM, Rob Gaddi wrote: On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, Use -1, which is the same as len(s)-1 but faster. This illustrates one probl

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread Terry Reedy
On 5/23/2018 6:07 PM, asa32s...@gmail.com wrote: On Wednesday, May 23, 2018 at 5:51:42 PM UTC-4, asa3...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a function that gives me last number of index thanks thanks, it

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread Terry Reedy
On 5/23/2018 5:56 PM, Rob Gaddi wrote: On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, Use -1, which is the same as len(s)-1 but faster. >>> s = 'kitty' >>> s[len(s)-1] 'y' >>> s[-1] 'y' -- Terry Jan Ree

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread Mark Lawrence
On 23/05/18 22:56, Rob Gaddi wrote: On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a function that gives me last number of index thanks Not sure I'm following your question; len(s

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread asa32sd23
On Wednesday, May 23, 2018 at 5:51:42 PM UTC-4, asa3...@gmail.com wrote: > s = "kitti" > > 0,1,2,3,4 > k,i,t,t,i > > how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a > function that gives me last number of index > > thanks thanks, it seems just a len(s) -1 is the righ

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread bartc
On 23/05/2018 22:51, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a function that gives me last number of index Not for that trivial task. But you can create your own: def upb(x): return len(x)-1 # '

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread asa32sd23
On Wednesday, May 23, 2018 at 5:56:26 PM UTC-4, Rob Gaddi wrote: > On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: > > s = "kitti" > > > > 0,1,2,3,4 > > k,i,t,t,i > > > > how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a > > function that gives me last number of index

Re: how to get INDEX count, or last number of Index

2018-05-23 Thread Rob Gaddi
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote: s = "kitti" 0,1,2,3,4 k,i,t,t,i how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a function that gives me last number of index thanks Not sure I'm following your question; len(s)-1 is much faster than enumerating o