'Python TypeError: 'float' object is not callable when using Min() Max()
I kept getting TypeError: 'float' object is not callable when I try to get the Min and Max value from my list using min() and max(). Any idea how to fix this please?
Here is my code:
count=0
sum=0.0
max=0.0
min=0.0
list=[]
while True:
sval=input('enter a number: ')
if sval=='done':
break
try:
fval=float(sval)
except:
print('invalid number')
continue
sum = sum+fval
count=count+1
list.append(fval)
print(list)
max_number = max(list)
min_number = min(list)
print(sum, count, sum/count, max_number, min_number)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
