|
1 | 1 | my_sample_list = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12] |
2 | 2 |
|
3 | | -# The magic pass below: |
4 | | -# Create a variable, like "i", that uses the last index position in the array "my_sample_list". Remember we can access the length property of an array using len, and that the position will always be 1 less than the item number (item one is index 0, item 5653 would be one less...) |
| 3 | +# Modify the loop below to print from end to start |
5 | 4 |
|
6 | | -# You can now use the variable holding the last position to iterate until you get to the first position- which will always be 0. Create a for loop using that variable, make sure the value of the variable is modified on each iteration of the loop. |
7 | | -# while some_variable_reference > 0: |
8 | | -# print(my_sample_list[some_variable_reference]) |
9 | | -# chage after doing what we wanted, change the variables value so that the next pass it references the new index position |
| 5 | +for i in range(0, len(my_sample_list)): |
| 6 | + print(my_sample_list[i]) |
0 commit comments