Login
Remember
Register
Ask a Question
What is [::-1} used for?
0
votes
asked
Oct 14, 2021
in
Python
by
rajeshsharma
What is [::-1} used for?
python-range
Python-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Oct 14, 2021
by
rajeshsharma
[::-1} reverses the order of an array or a sequence. However, the original array or the list remains unchanged.
import array as arr
Num_Array=arr.array('k',[1,2,3,4,5])
Num_Array[::-1]
...