diff --git a/pyorientAssignment.py b/pyorientAssignment.py index 21e42f1..2d11b09 100644 --- a/pyorientAssignment.py +++ b/pyorientAssignment.py @@ -1,9 +1,8 @@ - import pyorient import sys client = pyorient.OrientDB("localhost", 2424) -session_id = client.connect("root", "admin") +session_id = client.connect("root", "474F1CBE549F9E33FC8A0793C7819485072DAE07A4B704138010F28A28B69DF9") db_name = "soufun" db_username = "admin" db_password = "admin" @@ -15,11 +14,11 @@ print "database [" + db_name + "] does not exist! session ending..." sys.exit() -lat1 = 22.532498 -lat2 = 22.552317 +lat1 = 22.536870 +lat2 = 22.553872 -lng1 = 114.044329 -lng2 = 114.076644 +lng1 = 114.026551 +lng2 = 114.060868 query = 'SELECT FROM Listing WHERE latitude BETWEEN {} AND {} AND longitude BETWEEN {} AND {}' @@ -40,10 +39,26 @@ print record.price +s = 0 +for record in records: + s += record.price + + +miNum = 10000000 +for record in records: + if record.price < miNum: + miNum = record.price + +maNum = 50 +for record in records: + if record.price > maNum: + maNum = record.price + + # [PRINT OUT THE RESULTING VALUES BY CONCATENATING THEM TO THESE LINES TO CHECK YOUR WORK] -print 'min price: ' -print 'max price: ' -print 'average price: ' +print 'min price: '+ str(miNum) +print 'max price: '+ str(maNum) +print 'average price: '+ str(s/numListings) client.db_close() \ No newline at end of file