Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Week03/weighted_gokhankoray_bulbul.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import random

def weighted_srs(data, n, weights, with_replacement):
Sample = []
if (with_replacement):
Sample = random.choices(data, weights, k=n)
else:
Sample = random.sample(data, n, counts=weights)
return Sample