Re: why do I get syntax error on if : break

2018-05-25 Thread asa32sd23
On Thursday, May 24, 2018 at 10:12:46 PM UTC-4, asa3...@gmail.com wrote: > here is the code, i keep getting an error, "break outside loop". if it is > false just exit function > > > def d(idx): > if type(idx) != int: > break > > d('k') thanks... I believe the compiler. So how do I

Re: cleaner version of variable, new line

2018-05-24 Thread asa32sd23
On Thursday, May 24, 2018 at 8:51:07 PM UTC-4, asa3...@gmail.com wrote: > hi just seeing if there is a cleaner way to write this. > > s1= "kitti" > s2= 'kitti' > i= 3 > print(s1+ "\n" + "="*i + "^" + "\n" +s2) > > > > kitti > ===^ > kitti more legible that way... thks --

why do I get syntax error on if : break

2018-05-24 Thread asa32sd23
here is the code, i keep getting an error, "break outside loop". if it is false just exit function def d(idx): if type(idx) != int: break d('k') -- https://mail.python.org/mailman/listinfo/python-list

cleaner version of variable, new line

2018-05-24 Thread asa32sd23
hi just seeing if there is a cleaner way to write this. s1= "kitti" s2= 'kitti' i= 3 print(s1+ "\n" + "="*i + "^" + "\n" +s2) > kitti ===^ kitti -- https://mail.python.org/mailman/listinfo/python-list

Re: how to return last condition if other 2 not met?

2018-05-23 Thread asa32sd23
On Wednesday, May 23, 2018 at 8:55:59 PM UTC-4, MRAB wrote: > On 2018-05-24 00:57, asa32s...@gmail.com wrote: > > i want to check/return for 3 conditions, it loops shortest str and finds > > diff in other > > 1. if difference is immediate before end of range, return index, exit > > 2. if string

how to return last condition if other 2 not met?

2018-05-23 Thread asa32sd23
i want to check/return for 3 conditions, it loops shortest str and finds diff in other 1. if difference is immediate before end of range, return index, exit 2. if string length is same and index loop is done, return 'identical' 3. if neither of above is found. it means the short loop ended and

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

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

how to get INDEX count, or last number of Index

2018-05-23 Thread asa32sd23
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 -- https://mail.python.org/mailman/listinfo/python-list