+ 4
Challenge reverse an array
Write a custom function to reverse an array. Print the array before and after you reverse it. For example : Input : {1,2,3,4,5} Output : {5,4,3,2,1} Keep it simple and have fun!
7 Answers
+ 7
Python : a[::-1]
+ 7
+ 5
https://code.sololearn.com/cbaelxdi1fYO/?ref=app
+ 1
https://code.sololearn.com/cKHyqTsvuYsE/?ref=app
0
I can do it easily with ruby:
arr=[1,2,3,4,5,6]
res=arr.reverse
print res
fake=gets