In python the ord() function takes in a character and returns the ASCII value of that character.
For example -
ord(‘p’) returns 112 (of type integer).
To get the ASCII index of the first character of the string, ord(s1[0]) can be used where s1 resembles the variable.
Additionally, if you want to compare two strings lexicographically, you can directly use the logical operators.
For example - ‘a’ < ‘b’, returns True
while ‘c’ > ‘f’ returns False