Using functions to do subtasks and calculate results

# -*- coding: utf-8 -*-
"""
Created on Wed Mar 24 11:17:43 2021

@author: rmontant
"""

def get_numbers(filename):
    # Read numbers from a datafile
    numbers = []
    handle = open(filename, 'r')
    for line in handle.readlines():
        n = float(line)
        numbers.append(n)
    handle.close()
    return numbers
#--------

def arithmetic_mean(lst):
    mean = sum(lst) / len(lst)
    return mean
#--------

def geometric_mean(lst):
    import math
    return  math.prod(lst) ** (1/len(lst))
#--------


def main():
    filename = input('What data file? ')
    numbers = get_numbers(filename)
    #print(numbers)
    print(len(numbers), 'values in datafile')

    print()
    print('arithmetic mean:', arithmetic_mean(numbers))

    print()
    print('geometric mean:', geometric_mean(numbers))
#--------

main()