n = [3, 5, 7]
def print_list(x):
for i in range(0, len(x)):
print x[i]
print i
print_list(n)
I thought since the program is iterating through the index, having the range as len(list) would be out of range. However, this is apparently the correct way, and I'm not really sure why. Can somebody explain?