Pig Latin Script and Runtime 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
I don't think speed should be your primary concern in this case. The only thing I could come up with as an improvement is to change consonants:

from string import ascii_lowercase

VOWELS = ("a", "e", "i", "u", "o", "y", "w")
CONSONANTS = tuple(char for char in ascii_lowercase if char not in VOWELS)
# These can be constants because they're always the same (at least for the latin alphabet).


Also, you don't handle the case where string is not lowercase. To account for that:

def pig_latin(string):
    string = string.lower()  
    if string[-1] in CONSONANTS:
        string = string[1:] + string[0] + "ay"
    else:
        string = string + "way"
    return string


As @Ludisposed suggested, you don't actually have to convert the entire string to lowercase, if string[-1].lower() in CONSONANTS would do.