[Tutor] HELP PLEASE

Marissa Russo mrusso11 at u.rochester.edu
Mon Aug 12 12:54:51 EDT 2019


Hello,

I am trying to figure out what is going on and why my output is saying “<function mean at …….>” instead of giving me a number. Please let me know if you see the error in my code!!

import math

def get_numbers():
    print("This program will compute the mean and standard deviation")
    file1 = input("Please enter the first filename: ")
    file2 = input("Please enter the second filename: ")
    x = open(file1, "r")
    y = open(file2, "r")
    nums = x.readlines()
    nums2 = y.readlines()

    return nums, nums2

def mean(nums):
    for num in nums:
        _sum += num
    return _sum / len(nums)

def mean2(nums2):
    for num in nums2:
        _sum += nums2
    return _sum / len(nums2)

def main():
    data = get_numbers()

    print("The mean of the first file is: ", mean)
    print("The mean of the second file is: ", mean2)
main()



More information about the Tutor mailing list