Wrote a basic pig latin script in python where the input is a string and it outputs the pig latin equivalent. I was just wondering what the runtime of this code would be and if there was a way to make it quicker. Off the time of my head, I would assume that the runtime would be \$O(26)\$ or just constant because all you do is look at the last letter and compare it to the list.
def pig_latin(string):
consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
if string[-1] in consonants:
string = string[1:] + string[0] + "ay"
else:
string = string + "way"
return string