I am not familiar with python. But here is an attempt using awk
. You may call it from python
using appropriate system commands.
Verify the count range between 1200 to 1600
awk '( $1~/[0-9]+\.[0-9]+-[0-9]+\.[0-9]+/ && ($2<1200||$2>1600) ) {print $2}' file
Output:
1195
144
Calculate Average
awk '$1 ~ /[0-9]+\.[0-9]+-[0-9]+\.[0-9]+/ {total+=$2; cnt++;} END {printf "Average = %.2f\n", total/cnt}' file
Output:
Average = 1339.38