# A function to find the mean of grouped data items

Page 1 of 1

## 0 Replies - 277 Views - Last Post: 26 January 2009 - 11:54 AM

### #1 atik97 Reputation: 144
• Posts: 715
• Joined: 16-September 08

# A function to find the mean of grouped data items

Posted 26 January 2009 - 11:54 AM

Description: This function can find the mean of a grouped data items.
```def mean():
n=int(input("Enter number of class:"))
h=float(input("Enter class interval:"))
sum_f=0
sum_fx=0
for i in range(n):
print ("For class %s"%(i+1))
l=float(input("Enter lower limit:"))
#upper limit
u=l+h
f=int(input("Enter frequency:"))
x=(l+u)/2.0
fx=f*x
sum_fx=sum_fx+fx
sum_f=sum_f+f

#mean of the data
mean=sum_fx/sum_f
print("The mean of the given data is:%s"%mean)

```

Is This A Good Question/Topic? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }