diff --git a/Week03/weighted_fevzi_bagriacik.py b/Week03/weighted_fevzi_bagriacik.py new file mode 100644 index 0000000..3fe8700 --- /dev/null +++ b/Week03/weighted_fevzi_bagriacik.py @@ -0,0 +1,6 @@ +import random + +def weighted_srs(population, n, weight, with_replacement=False): + if with_replacement == True or weight != None: + return random.choices(population, weight=weight, k=n) + return random.sample(population, n)