Week 3 assignment 1
unknown
python
8 months ago
351 B
4
Indexable
Never
for i in range(len(marks)): for j in range(len(marks)): if marks[i] > marks[j]: marks[i], marks[j] = marks[j], marks[i] median = 0 if len(marks) % 2 != 0: median = marks[len(marks)//2] else: mid_index = len(marks)//2 median = (marks[mid_index] + marks[mid_index-1]) / 2
Leave a Comment