How to make the execution of function by key from dictionary Python 3?

There is a dictionary where each key is a letter and each value - function. The user is prompted for a letter, how to perform the function that corresponds to the entered letter?

Example broken code:
def main():
 while True:
 key = str(input("Press R to read a file\press E to enter data\press L to leave the program\n"))
 key = key.lower()
execute(key)

def execute(command):
 return {
 'r' : readfile(),
 'e' : enterdata(),
 'l' : exit()
 }.the get(command, "Command not found")

def readfile():
#Action

def enterdata():
#Action

def exit():
#Action

main()

If I understand correctly, the code here returns the whole list, so the execution result will be that all functions operate on a queue.
June 3rd 19 at 19:31
1 answer
June 3rd 19 at 19:33
Solution
UPD: Yay, solved! Had to podavitsya head, but it turned out exquisitely

def main():
 while True:
 key = str(input("Press R to read a file\press E to enter data\press L to leave the program\n"))
 key = key.lower()
execute(key)


def readfile():
#Action


def enterdata():
#Action


dictOfCommands = {
 'r': readfile
 'e': enterdata,
 'l': exit
}


def execute(command):
dictOfCommands[command]()


main()

Find more questions by tags Python