Actually it will not work, because of line 36-37. change lines 36-38 to
if 0 <= calculate_accuracy(txpower, rssi) < 2: print beaconideventually I would also replace lines#33-35 with
beacon = beacon.split(',') beaconid = beacon[0] txpower = float(beacon[4]) rssi = float(beacon[5])