Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def smallestCharLargerThan(keyChar,inputString):
- smallest = chr(255)
- ind = 0
- for i in range(0,len(inputString)):
- if inputString[i].lower() > keyChar.lower():
- if inputString[i].lower() <= smallest:
- smallest = inputString[i]
- ind = i
- print("In {}, the smallest character greater than {} is {} and occurs at position {}.".format(inputString, keyChar, inputString[ind], ind))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement