checking if a string is in alphabetical order in python

Solutions on MaxInterview for checking if a string is in alphabetical order in python by the best coders in the world

showing results for - "checking if a string is in alphabetical order in python"
Jona
04 Aug 2016
1def isInAlphabeticalOrder(word):
2    for i in range(len(word) - 1):
3        if word[i] > word[i + 1]:
4            return False
5    return True
6