Skip to content

Instantly share code, notes, and snippets.

@harshildarji
Created November 24, 2018 23:18
Show Gist options
  • Save harshildarji/26f4080293f6905f6be3653ca9907832 to your computer and use it in GitHub Desktop.
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!
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