import sys
from db import connect_db

c = connect_db()
cur = c.cursor()


# 2.g
def pop_obmocja(x, y, distance):
    cur.execute(
        "select sum(population) from naselje where x > {} and y > {} and x < {} and y < {}".format(x - distance,
                                                                                                   y - distance,
                                                                                                   x + distance,
                                                                                                   y + distance))
    result = cur.fetchone()
    return result[0]


if __name__ == '__main__':
    if len(sys.argv) > 1:
        _, x, y, distance = sys.argv
        pop_obmocja(float(x), float(y), float(distance))
    else:
        print(pop_obmocja(40, 40, 10))
        print(pop_obmocja(40, 40, 20))

5c98c99f636fbd0447e580862240582df9875a08
<mask token>

<mask token>


def pop_obmocja(x, y, distance):
    cur.execute(
        'select sum(population) from naselje where x > {} and y > {} and x < {} and y < {}'
        .format(x - distance, y - distance, x + distance, y + distance))
    result = cur.fetchone()
    return result[0]


if __name__ == '__main__':
    if len(sys.argv) > 1:
        _, x, y, distance = sys.argv
        pop_obmocja(float(x), float(y), float(distance))
    else:
        print(pop_obmocja(40, 40, 10))
        print(pop_obmocja(40, 40, 20))

<mask token>
c = connect_db()
cur = c.cursor()


def pop_obmocja(x, y, distance):
    cur.execute(
        'select sum(population) from naselje where x > {} and y > {} and x < {} and y < {}'
        .format(x - distance, y - distance, x + distance, y + distance))
    result = cur.fetchone()
    return result[0]


if __name__ == '__main__':
    if len(sys.argv) > 1:
        _, x, y, distance = sys.argv
        pop_obmocja(float(x), float(y), float(distance))
    else:
        print(pop_obmocja(40, 40, 10))
        print(pop_obmocja(40, 40, 20))

import sys
from db import connect_db
c = connect_db()
cur = c.cursor()


def pop_obmocja(x, y, distance):
    cur.execute(
        'select sum(population) from naselje where x > {} and y > {} and x < {} and y < {}'
        .format(x - distance, y - distance, x + distance, y + distance))
    result = cur.fetchone()
    return result[0]


if __name__ == '__main__':
    if len(sys.argv) > 1:
        _, x, y, distance = sys.argv
        pop_obmocja(float(x), float(y), float(distance))
    else:
        print(pop_obmocja(40, 40, 10))
        print(pop_obmocja(40, 40, 20))

import sys
from db import connect_db

c = connect_db()
cur = c.cursor()


# 2.g
def pop_obmocja(x, y, distance):
    cur.execute(
        "select sum(population) from naselje where x > {} and y > {} and x < {} and y < {}".format(x - distance,
                                                                                                   y - distance,
                                                                                                   x + distance,
                                                                                                   y + distance))
    result = cur.fetchone()
    return result[0]


if __name__ == '__main__':
    if len(sys.argv) > 1:
        _, x, y, distance = sys.argv
        pop_obmocja(float(x), float(y), float(distance))
    else:
        print(pop_obmocja(40, 40, 10))
        print(pop_obmocja(40, 40, 20))
