diff --git a/Week03/weighted_serhat_tufan.py b/Week03/weighted_serhat_tufan.py new file mode 100644 index 0000000..2c50f39 --- /dev/null +++ b/Week03/weighted_serhat_tufan.py @@ -0,0 +1,10 @@ +import random +def weighted_srs(data=data,n=3,weights=weights,with_replacement=True): + if(with_replacement): + return random.choices(population=data,weights=weights,k=n) + else: + return(random.sample(population=data,k=n)) +#data=["Durhasan","Bakhele","Sövüşçü","Döndü"] +#weights=[0.1,0.6,0.1,0.2] +#sample=weighted_srs(data=data,n=3,weights=weights,with_replacement=True) +#print(sample)