We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 842b3e7 + 68cb58a commit d0ccf6aCopy full SHA for d0ccf6a
Week03/weighted_mustafa_kilic.py
@@ -0,0 +1,6 @@
1
+import random
2
+
3
+def weighted_srs(data, n, weights, with_replacement=False):
4
+ if with_replacement == True or weights != None:
5
+ return random.choices(data, weights=weights, k=n)
6
+ return random.sample(data, n)
0 commit comments