• Register
0 votes
103 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.

6 5 3
6,930 points

1 Answer

0 votes

Solution :

Please find your solution as follows:
>>> L = [0,10,20,30,40]
>>> L.reverse()
>>> L
[40,30, 20, 10, 0]

Or

>>> L[::-1]
[40,30, 20, 10, 0]
9 7 4
38,600 points

Related questions

0 votes
2 answers 105 views
105 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.
asked Nov 24, 2019 alecxe 7.5k points
0 votes
2 answers 82 views
82 views
Problem : Python Program to Calculate the Average of Numbers in a Given List
asked Oct 21, 2019 peterlaw 6.9k points
0 votes
2 answers 14 views
14 views
Problem: Given the array a, write an expression that refers to the first element of the array?
asked Apr 12 ArifulIslam 5.7k points
0 votes
1 answer 18 views
18 views
Problem: Given an ArrayList a, write an expression that refers to the first element of the ArrayList?
asked Apr 12 ArifulIslam 5.7k points
1 vote
1 answer 21 views
21 views
Problem: Recently I started learning python and just about to know more about list and tuple in python. I am a little bit known to the list and tuple and I can add or subtracts elements in a list. I wonder how to multiply all elements in a list python? I tried it in the adding process but it didn’t work for me. Is it doable? Could anybody please show me the way to do it?
asked Apr 3 Gavin 15.3k points