I am trying to gather numbers from a simple text file and compute the average of those numbers. However, I need two separate averages from the text file. The text file would be in this format.
random string
num 1
num 2
random string
random string
num 1
num 2
random string
random string
num 1
num 2
random string
random string
num 1
num 2
random string
... and so on and so forth, the pattern would always be this way.
I'd need to be able to get the average of all the num1's, then the average of all the num2's separately. The numbers would be integers. What method could I use to do this? Maybe adding them to an array or list and calculating them that way? Or is there another way?
Any guidance or advice would be much appreciated.