Question: These are the numbers that display in my entry box when i press a button

```
def numberone():
    displayblox.insert(0,int(1))

def numbertwo():
    displayblox.insert(0,int(2))

def numberthree():
    displayblox.insert(0,int(3))

def numberfour():
    displayblox.insert(0,int(4))

def numberfive():
    displayblox.insert(0,int(5))

def numbersix():
    displayblox.insert(0,int(6))

def numberseven():
    displayblox.insert(0,int(7))

def numbereight():
    displayblox.insert(0,int(8))

def numbernine():
    displayblox.insert(0,int(9))

def plusone():
    displayblox.insert(0,'+')

def minusone():
    displayblox.insert(0,'-')

def divideone():
    displayblox.insert(0,'/')

def timesone():
    displayblox.insert(0,'*')

```

this part does the adding up off what is in the entry box when i press = and then displays it 

```
def equalsone():
    answer = int(displayblox.get())
    displayblox.delete(0,END)
    displayblox.insert(0,answer) 

```

Answer: 
You can't just call `int('2+2')` and get `4`; the `int()` function only converts numbers to integers, but doesn't do arithmetic.

To do this, you need to parse the string into a parse tree and do the arithmetic on that. It might be easier to keep track of the input in the form of a tree, rather than a string that you need to turn back into a tree.

Or you can use `eval`, but that leads to the Dark Side: `eval` will happily execute *any* code that you throw at it, so it is generally considered unsafe. This may actually be a case where it is safe, but if you're not certain, then assume it's not.
You can do:

```
my_str="2+2"
result=int(my_str.split("+")[0])+int(my_str.split("+")[1])

```

This works by breaking the string up into a list `["2","2"]`, in which you then call int on the list index that you want to convert to int. Then you can add them up together since they are both `int`s.

If you want something a bit more complex, for example, undefined length of an addition string, you could do:

```
def compile_them_all(in_string,operator):
    if not isinstance(operator,str): raise Exception("operator must be a string.")
    if not isinstance(in_string,str): raise Exception("in_string must be a string.")
    return sum(int(x) for x in in_string.strip().split(operator))

```

Alternatively, you could also do `result=eval("2+2")`, however, this is highly discouraged because you can put python code as input and it will affect the python program during run-time (for example, I could do `result=eval("exit(0)")` and it will exit the program).