Skip to content
Open
Changes from all 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
7 changes: 7 additions & 0 deletions Week03/weighted_ozge_ucar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import random
def weight_srs(data , n,weights, with_replacement = False):#i create a function which named weight_srs take 4 parameter
if with_replacement == True or weights != None:
random_list= random.choices(data , k=n, weights=weights)#random_list variable hold a random choices from data set with weights
else:
random_list=random.sample(data,n)#if there is no weights then random_list variable hold just random elenments of data set
return random_list#the function weight_srs return the random_list