def get_usersId5(self, city_id, gen, age):
with self.connection:
result = self.cursor.execute("SELECT `user_id` FROM `users` WHERE `city_id` = ? AND your_gen = ? where age between (?-2) and (?+2)", (city_id, gen, age,)).fetchall()
activea = []
for row in result:
activea.append(row[0])
return activea
from db import Database
db = Database('database.db')
city = "москва"
gen = "М"
age = int(input())
ank = db.get_usersId5(city, gen, age)
print(ank)