returning the list reversed
问题 i have this question: Write a function reverse3(nums) that takes a list of ints of length 3 called nums and returns a new list with the elements in reverse order, so [1, 2, 3] becomes [3, 2, 1]. i solved it by: def reverse3(nums): return [nums[2]] + [nums[1]] + [nums[0]] however, the answer is straight foward. My main question, how do i get nums reversed, when i don't know how many ints there are in nums ?. I've got this: nums[::-1] which does return nums reversed.but i'm looking for a