The ascending order of the given data set is:
6, 8, 10, 10, 11, 12, 12, 15, 16, 16, 17, 18, 18, 20, 21, 21, 23, 24, 24, 24, 29, 30, 31, 32, 32, 32, 35, 36, 39, 40
Number of values in the data set = n = 30
n/2 = 30/2 = 15
15th data value = 21
(n/2) +1 = 16
16th data value = 21
Median = [(n/2)th observation + {(n/2)+1}th observation]/2
= (15th data value + 16th data value)/2
= (21 + 21)/2
= 21