Creating a basic calculator for integers
Make it robust

Your solution could be a lot more robust. For example, you don't currently validate that x or y are integers - you should check, and if they aren't you should reject them. Additionally, you might want to do some string manipulation of the operator (for example, strip spaces). 

It could also be useful to not take strings, but instead create an enumeration (Python 3.4+ Python 3.4-). I'd also advise that you look at the linked stack overflow post from the comments (here for posterity). That makes this into a trivial function, where the only work is in your lookup table.

Use exceptions

Your prompt doesn't define what should happen if you get 0 as the denominator; I'd throw an exception (or if you're using operator let it handle it for you) instead of returning "undefined", as it is much more surprising to get this:

&gt;&gt;&gt; calculate(9, 0, "//") + 2
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: must be str, not int


Than it is to get this:

&gt;&gt;&gt; calculate(9, 0, "//") + 2
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "&lt;stdin&gt;", line 1, in calculate
ZeroDivisionError: division by zero


Additionally, by throwing the expected error other applications that may know how to handle a divide-by-zero event will "just work"TM with your module.

Format your code

Instead of the comment #calculator right above the function definition, which tells us literally nothing, add a docstring that defines inputs, outputs, and purpose of the function.

Additionally, your spacing is a little weird; look up PEP8 and see what it recommends.