I was wondering which was the better option for looping through arrays between these two implementations. The first one uses an extra variable ('count'), but has a neater 'for' line, whereas the second one saves on a variable but has to use the 'range' and 'len' function Is there a better option? Or is it up to personal preference? Thanks
# First implementation
names = ["Phil", "Quentin", "Rachel", "Simone"]
scores = [45, 27, 83, 63]
count = 0
for person in names:
line = person + " scored " + str(scores[count])
print(line)
count += 1
# Second implementation
names = ["Phil", "Quentin", "Rachel", "Simone"]
scores = [45, 27, 83, 63]
for i in range(0, len(names)):
line = names[i] + " scored " + str(scores[i])
print(line)