You can use the built-in map() to set the variables x and y .
def bla(self,x,y) : for key in self.DataBase : x,y = map(float, self.DataBase[key]) if x == dept and y == year: return key
If you prefer to use items() , you can do the following (equivalently):
def bla(self,x,y): for key, val in self.DataBase.items(): x, y = map(float, val) if x == dept and y == year: return key
Here's another way to do this without map() , it gives you the advantage of unpacking tuples when iterating over a dict:
def bla(self,x,y): for key, (x, y) in self.DataBase.items(): if x == dept and y == year: return key
You can also write above, since using list comprehension, although I would say that the one above is preferable:
def bla(self,x,y): found = {key for key, (x, y) in self.DataBase.items() if x==dept and y==year} found = ''.join(num)
The following steps for Python 3, which I assume, are what you want as one of your Python 3.x tags