external functions in Python 3.4
Question: I have been working on an elements dictionary and I have encountered a problem
with running external functions through inputs. I need to take an input and
use it to call a function with several variables. here is my code:

    
    
    import atoms
    import time
    print("Hello, and welcome to the element dictionary. This app takes an element symbol")
    print(" and outputs a small amount of data about the element.")
    element=input("please input an elements symbol :")
    (element)
    print('catagory: ',cat )
    print(' atomic number: ',atomn)
    print(' atomic weight: ',atomw)
    print('colour: ',colour )
    print(' phase: ',phase )
    print(' melting point: ',meltpoint)
    print('boiling point: ',boilpoint)
    print('crystal structure: ',cstruc)
    time.sleep(100)
    

`(element)` is where an external function is needed, and 'atoms' is where the
functions are stored.


Answer: > I need the function to be inputted by the user

I don't really know if this what you are looking for. But you have to know
that Python has the so called [First-class
function](http://en.wikipedia.org/wiki/First-class_function). That is, you may
store a function in a variable like any other value. In a varaible or in a
dictionary.

To familiarize yourself with that idea, take some time experimenting with this
example:

    
    
    def f():
        print("This is f")
    
    def g():
        print("This is g")
    
    def other():
        print("Other choice")
    
    actions = {
       "f": f,
       "F": f,
       "g": g,
       "G": g
    }
    
    your_choice=raw_input("Choose f or g: ")
    your_fct = actions.get(your_choice, other)
    #                                   ^^^^^
    #                                default value
    
    your_fct()
    

Of course, you can pass arguments while calling `your_fct` just like any other
function.

