# given that a refers to a list, write the necessary code to reverse the elements of the list.

203 views

## Problem :

Facing following issue related to list in Python

given that a refers to a list, write the necessary code to reverse the elements of the list.

## Solution :

```>>> L = [0,10,20,30,40]
>>> L.reverse()
>>> L
[40,30, 20, 10, 0]```

Or

```>>> L[::-1]
[40,30, 20, 10, 0]```
38.6k points

## Related questions

260 views
Problem : I need solution for below problem using Python Given that play_list has been defined to be a list, write a statement that sorts the list.
18 views
Problem: how to Solve this: error: term refers to an individual item in a list. HELP! I need help understanding this: term refers to an individual item in a list. Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
19 views
Problem: I have no idea to solve this, somebody help : Given a list named play_list, write an expression whose value is the length of play_list.
12 views
Problem: How can I reverse a list in Python?
94 views
Problem: Given the array a, write an expression that refers to the first element of the array?
38 views
Problem: Given an ArrayList a, write an expression that refers to the first element of the ArrayList?
33 views
Problem: I was trying to solve a problem in Codility provided below, Write a function: class Solution { public int solution(int[] A); } that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A. For example, given A = [1, 3, 6, 4, 1, 2], the function ... for (int i = 0; i < N; i++) { if (C[i] != 0) { return (i + 1); } } return (N + 1); }