I want to reverse a list on Python without use reversed
command. Any ideas?
The query was to find another way to do the reverse the list without use any "standar" Python command like reverse. Thank in advance!
list = []
x = 1
#Import 20 random numbers
for i in range (0,20):
list.append (x)
print (list)
for i in range (20,0,-1): # <-- I know, this is wrong. I used it as an example
print (list[i])
SOLUTION:
list = []
x = 1
#Import 20 random numbers
for i in range (0,20):
list.append (x)
print (list)
for i in range(len(list) - 1, -1, -1):
print(list[i])