Created
November 24, 2018 23:18
-
-
Save harshildarji/26f4080293f6905f6be3653ca9907832 to your computer and use it in GitHub Desktop.
A little script to check whether the alphabets in a word are presented in an alphabetical order or not!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ip = input('Enter a string: ') | |
op = ip[0] | |
for i in range(len(ip) - 1): | |
dist = ord(ip[i].lower()) - ord(ip[i+1].lower()) | |
if dist > 0: op += ' > ' + ip[i+1] | |
else: op += ' < ' + ip[i+1] | |
print(op) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment