Trying to find median but keep getting list indices must be integers, not float error and am not sure what to do.
sorted_data = sorted(data, key=lambda d:d.a
The statistics module is part of the standard library:
import statistics data = [1, 2, 3, 4] statistics.median(data)