How can I avoid having to increment the sequence counter manually in the following Python code:
sequence = 0
for value in random.sample(range(1000), 7):
# do something with value and sequence
sequence += 1
Enumerate! You can refer to the Python docs.
for sequence, value in enumerate(random.sample(range(1000), 7)):
# do something with value and sequence