问题
I understand that the following line will give the given result:
for in range(5):
print(i)
0 1 2 3 4
But I don't understand how if adding 3 separate parameters the result is confusing. How is this returning these particular results? (4 6 and 8) ????
for i in range(4, 10, 2):
print(i)
4 6 8
回答1:
Starts at 4, then increments by 2, to end at 8 because 10 < 10
is false. So 4 6 8
来源:https://stackoverflow.com/questions/32096391/pythons-range-function-with-3-parameters