Help understanding 5.12 - Sample Offline Data

#1

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)
0 Likes