# I am getting error when find the avg, the error is as follows AttributeError: 'float' object has no attribute 'start'

#import multiprocessing

# passing series of numbers as array in code

nums =[12, 75, 30, 91, 49, 52, 76]

# Python program to get average of a list

def Average():
return round((sum(nums) / len(nums)) , 2)

# Driver Code

``````average =  Average()
``````

# Printing average of the list

``````print("Average of the list = " +str(average))
``````

def maximum():
return max(nums)

# Driven code

print("Maximum number in the given list is = "+ str(maximum()))

def minimum():
return min(nums)

# Driven code

print("Minimum number in the given list is = "+ str(minimum()))

t1 = Average()
t2 = maximum()
t3 = minimum()

# Executing the threads, The 3 threads will store the values globally for

``````#the parent thread to output.
``````

t1.start()
t2.start()
t3.start()

t1.join()
t2.join()
t3.join()

The problem is in these lines:

``````t1 = threading.Thread(target=Average, name=‘t1’)
t1 = Average()
t2 = maximum()
t3 = minimum()
``````

In the first 3 lines you create the threads and assign the variables t1, t2 and t3 to them. However in the last 3 lines you reassign these variables to be the return value of the functions Average() etc.

Looking at the Average() function:

``````def Average():
return round((sum(nums) / len(nums)) , 2)
``````

The round function in Python returns a floating point number which gets assigned to t1 (for instance: 10.0). Then you proceed to call the start function on the variable t1, which represents a float at this moment:

``````t1.start()
``````

As a floating point does not have a start() function, it throws an AttributeError!

Hope this helps!

Yes tried what you suggested and removed the lines reassigning the variables, the error is gone
nums =[12, 75, 30, 91, 49, 52, 76]

def Average(nm):
return sum(nm) / len(nm)

average = Average(nums)

print("Average of the list = " +str(average))

def maximum(mx):
return max(mx)

print("Maximum number in the given list is = "+ str(maximum(nums)))

def minimum(mn):
return min(mn)

print("Minimum number in the given list is = "+ str(minimum(nums)))