In a recursive way, you can import count from itertools
Or define the same method:
def loops( I=0, S=1 ): n = I while True: yield n n += S
With this method, you can get the endpoint value when you create a substring in your allitic process.
Now the anallize method looks (based on spacegame and Mr. Tim Petter's suggestion )
def anallize(inStr):
Finally, for verification or execution it pours out:
# for execution pourposes of the exercise: s = "azcbobobegghakl" print "Longest substring in alphabetical order is: " + anallize( s )
A great piece of this work has begun: spacegame and was attended by Mr. Tim Petters , used in native str methods and code reuse.
Answer:
The longest substring in alphabetical order: ccl
jam65st
source share