We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8d271d4 + 37ce4f9 commit 40f7f13Copy full SHA for 40f7f13
Week03/weighted_mustafafurkan_yilmaz.py
@@ -0,0 +1,7 @@
1
+import random
2
+
3
+def weighted_srs(data, n, weights, with_replacement = False):
4
+ if weights == None and with_replacement == False:
5
+ return random.sample(data, n)
6
+ else:
7
+ return random.choices(data, weights = weights, k = n)
0 commit comments