Coded in IDLE. Project was to create a program that read the contents of a .txt file and calculated the avg of all numbers in the file. This was to be done using 2 Higher - Order Functions (mapping and reducing) of your choice. I've test ints and decimals with this program and it has worked perfectly, have not tried putting strings into the test file but I'd assume it wouldn't work for obvious reasons.
input_File = input('Name of file: ') #ask user for name of file
file = open(input_File, 'r') #open file
file = file.read() #read file
file = file.split() #put numbers into list
file = list(map(float, file)) #convert list into floats
file_Sum = functools.reduce(lambda x, y: x + y, list(file)) #grabs sum of file
print(file_Sum / len(file)) #average function using file sum from reduce fuction