Created
January 7, 2021 07:25
-
-
Save tinshade/fb96e971a8df9773bb44bc3206147a19 to your computer and use it in GitHub Desktop.
A small python script that shows how you can iterate through an array in reverse, using FOR loop, without having manipulating the array itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Reverse Iterate an array using FOR and range in python3. | |
| arr = [2,4,-5,0,-120,23,2] | |
| # range(start, stop, step) | |
| for i in range(len(a)-1,-1,-1): | |
| print(arr[i], end=" ") #Prints 2 23 -120 0 -5 4 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment