This is 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 to_ints(strings): num_copy = [] for num in nums: num_copy.append(float(num)) return num_copy return to_ints(nums), to_ints(nums2) def mean(nums): _sum = 0 return(sum(nums)/len(nums)) def main(): data = get_numbers() m = mean(data[0]) m2 = mean(data[1]) print("The mean of the first file is: ", m) print("The mean of the second file is: ", m2) main() This is the output of my updated code: Traceback (most recent call last): File "/Applications/Python 3.7/exercises .py", line 37, in <module> main() File "/Applications/Python 3.7/exercises .py", line 33, in main m = mean(data[0]) File "/Applications/Python 3.7/exercises .py", line 29, in mean return(sum(nums)/len(nums)) TypeError: unsupported operand type(s) for +: 'int' and 'str' > On Aug 12, 2019, at 12:54 PM, Marissa Russo <mruss...@u.rochester.edu> wrote: > > 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() > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor