Say i have a random string s = 'abcdlfkdf'and i want to grab the largest substring thats in alphabetical order (Problem that has been solved in here before). But i want to learn how to get to the solution and how to inmerse my mind into the comparisons. Note that this is a small fraction of what the latter code would be, i just can't get my head around this small initial part.
My first initial crack at the problem was the following:
s = 'abcdlfkdf'
sub= ''
for i in s:
if s[0] < s[i+1]:
#Can't compare integers with strings
So obviously you can't compare integers with strings so you can't really compare individual character strings using index's. What is the alternative?
Can someone point me in the fundamental direction, would really want to solve this without looking anything remotely close to a solution. My mind needs to suffer through this.
Thanks!