I checked that this average code works:
final = (sum(num)/len(num))
But for some reason when I use my whole function.
def average(num):
final = (sum(num)/len(num))
return(final)
num = []
for x in range(5):
num.append(int(input("Please enter a number. ")))
print(num)
print(average)
It outputs this: <function average at 0x0000027D09927F70>
I don't know why it doesn't just output the average number?
Sorry I am not great at coding.
You didn't call the function, you printed the function itself instead. Try it like that:
def average(num):
final = (sum(num)/len(num))
return(final)
num = []
for x in range(5):
num.append(int(input("Please enter a number. ")))
print(num)
print(average(num)) #Edited this