Update vq.py

While loop replaced by a for loop (as suggested by richardtsai)