Skip to content

Commit b073304

Browse files
authored
Create shifted_mert_yuksel.py
1 parent d0ccf6a commit b073304

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Week05/shifted_mert_yuksel.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def shifted(x):
2+
3+
n = len(x)
4+
5+
x_bar = sum(x) / n
6+
7+
if n % 2 == 1:
8+
x_tilde = x[int((n + 1) / 2 - 1)]
9+
else:
10+
x_tilde = (x[int((n / 2) - 1)] + x[int(n / 2)]) / 2
11+
12+
diff = abs(x_bar - x_tilde)
13+
14+
return int(diff * 100)

0 commit comments

Comments
 (0)