#!/usr/bin/env python

# ----------------------------------------------------------------------------------- #
#
#  Python/ROOT macro for reading data in problem 5.1.
#
#  Author: Troels C. Petersen (NBI)
#  Email:  petersen@nbi.dk
#  Date:   14th of November 2015
#
# ----------------------------------------------------------------------------------- #

from ROOT import *


# ----------------------------------------------------------------------------------- #

# Open file for reading:
f = open('data_problem51.txt', 'r')
Nread = 0

# Read and ignore header line
header1 = f.readline()

# Loop over lines and extract variables of interest
for line in f:
    line = line.strip()
    columns = line.split()

    diam = float(columns[0])
    area = float(columns[1])
    print "  Diameter = %6.2f    Area = %8.1f"%(diam, area)

    Nread += 1

f.close()

print "  Number of lines read: ", Nread



raw_input('Press Enter to exit')
