Skip to content

Commit fb0ec9b

Browse files
authored
Fix error in index value calculation
1 parent 6ba648c commit fb0ec9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ch09-lists-tuples-and-dictionaries/4-challenge-list-of-lists.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def median(values):
3636
# Otherwise, if the length of the list is even, return
3737
# the mean of the two center values
3838
else:
39-
left_center_index = (len(values) - 1) / 2
40-
right_center_index = (len(values) + 1) / 2
39+
left_center_index = (len(values) - 1) // 2
40+
right_center_index = (len(values) + 1) // 2
4141
return mean([values[left_center_index], values[right_center_index]])
4242

4343

0 commit comments

Comments
 (0)