Apparently, I don’t understand the question because I don’t understand why the answer isn’t simply:
def random_sampling(k, A):
return random.sample(A, k)
What am I missing? I also tried:
def random_sampling(k, A):
A = random.sample(A, k)