Skip to content

Commit 4798717

Browse files
authored
Create weighted_birhat_tas.py
1 parent d57b17b commit 4798717

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Week03/weighted_birhat_tas.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import random
2+
3+
def weighted_srs(data,n,weights,with_replacement = False):
4+
if with_replacement == True or weights != None:
5+
sample = random.choices(data,k=n,weights = weights)
6+
else:
7+
sample = random.sample(data,n)
8+
return sample
9+

0 commit comments

Comments
 (0)