0
Comparing java and python for loops
Is it possible to run a for loop for a specific number of elements in a sequence? for example say I want to run a for loop only for the first 3 elements in this list: words = ["hello", "world", "spam", "eggs"] I know it is rare to be needed but in java setting boundaries about the for loop or determine how the counting variable changes(eg i++ or i-- in java) sometimes is really helpful! Thank you!
1 Resposta
0
in this case the len function is useful