Change a string into a function/def activator import random


import string

# every def from 'def nothing()' to 'def wxyz()' Print out several lines of text, printing: keyword 1, call number, phone number and keyword 2
def nothing():
    print("keyword: (nothing)\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def abc():
    print("keyword: abc\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def deft():
    print("keyword: deft\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def ghi():
    print("keyword: ghi\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def jkl():
    print("keyword: jkl\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def mno():
    print("keyword: mno\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def pqrs():
    print("keyword: pqrs\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def tuv():
    print("keyword: tuv\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

def wxyz():
    print("keyword: wxyz\ncalls: 1\n" + str(random_number()) + "\nkeyword: exit\n")

# keywords that are accepted and not denied
accepted_keywords = {
    0: nothing,
    1: abc,
    2: deft,
    3: ghi,
    4: jkl,
    5: mno,
    6: pqrs,
    7: tuv,
    8: wxyz
}

# creates a random phone number
def random_number():
    string = []
    x = 0
    while x != 10:
        x += 1
        number = str(random.randrange(0, 10))
        string.append(number)
    return str('(' + string[0] + string[1] + string[2] + ')' + string[3] + string[4] + string[5] + '-' + string[6] + string[7] + string[8] + string[9])

# these two things pick a random value &amp; key from the accepted_keywords() dictionary then calls that value &amp; key
#tester = random.randrange(len(accepted_keywords))
#accepted_keywords[tester]()

# randomizes letter so it can be aproved or denied
def random_keyword():
    keyword = ''
    chrt_count = random.choice([3,4])
    for i in range(chrt_count):
        lowercase = string.ascii_lowercase #lowercase letters
        random_letter = random.randrange(len(lowercase)) # chooses random character from var lowercase which is converted to a number based on its place in alphabet
        keyword_letter = lowercase[random_letter] # grabs the letter from lower using the number from var random_letter to located the place value of a letter
        keyword += keyword_letter
    while True:
        if keyword in accepted_keywords.values():
            print("keyword: " + keyword + "\n*Approved*\n")
            break
        else:
            print("keyword: " + keyword + "\nDenied\n")
            break

random_keyword()


Here is the scenario, I am using python 3.x and I am supposed use cases but since Python does not use cases, I had to use a dictionary.
My problem is that I have a function named wxyz() and I created another function named random_keyword that picks random letters from the alphabet, one at a time, and adds it into a variable named keyword that is a blank string. So by the time random_keyword has ran its course, keyword will have 3 or 4 random letters in it. For now let’s say that those random letters are “wxyz”, which is a string. Then I go through if keyword in accepted_key: print .... The problem is that keyword is a string, therefore it does not match the wxyz in accepted_keywords. Is there a way to turn a string into a function/def activator?
There are quite a lot of things you should do differently.

Let's start with your function random_number. You should not overwrite the string module (even though it is only locally), which you imported. You should also use list comprehensions to build the string. To pretty print the number as a phone number, use str.format. Use the fact that random.randrange takes an implicit 0 as its first argument (just like range). And finally use tuple unpacking, instead of manually indexing the list.

def random_number():
    phone_number = [random.randrange(10) for _ in range(10)]
    return "({}{}{}){}{}{}-{}{}{}".format(*phone_number)




Next, your random_keyword function. You can vastly simplify the building of random_letter by using a list comprehension again, together with str.join, to avoid costly string addition.

Your while True loop also serves no purpose, since you break it in either case. 

Also, what is the point of storing something in a dictionary (with \$\mathcal{O}(1)\$ lookup time if a key is in it) and then checking to see if something is in the values, which is a list and takes therefore \$\mathcal{O}(n)\$? At this point your dictionary is just a simple list. You can access its members with numbers from 0 to len(accepted_keywords). Instead have a list of your functions and have a dictionary with their names as keys (which you can build using a dictionary comprehension).

functions = [nothing, abc, deft, ghi, jkl, mno, pqrs, tuv, wxyz]
accepted_keywords = {f.__name__: f for f in functions}


def random_keyword():
    keyword = ''.join(random.choice(string.ascii_lowercase)
                      for _ in range(random.choice([3, 4])))
    print("keyword: {}".format(keyword))
    print("*Approved*\n" if keyword in accepted_keywords else "Denied\n")




Finally, Python has an official style-guide, PEP8. It recommends using ALL_CAPS for global constants (like accepted_keywords).

Python also has a docstring convention (written down in PEP257), which in its simplest form looks something like the following:

def random_number():
    """creates a random phone number"""
    ...


At this point you should also notice that that function name is not very descriptive, maybe something like random_phone_number instead?