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

Please log in or register to answer this question.

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 140 views
140 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 240 views
240 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 19 views
19 views
Problem: Given the array a, write an expression that refers to the first element of the array?
asked Apr 12, 2020 ArifulIslam 5.6k points
0 votes
1 answer 23 views
23 views
Problem: Given an ArrayList a, write an expression that refers to the first element of the ArrayList?
asked Apr 12, 2020 ArifulIslam 5.6k points
1 vote
1 answer 37 views
37 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, 2020 Gavin 15.3k points
0 votes
1 answer 121 views
121 views
Problem : I am facing below python list problem design a program that lets the user enter the total rainfall for each of 12 months into an array
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 45 views
45 views
Problem : How to remove all occurrences of a value from a list? I tried in Python remove() will remove the first occurrence of value in a list. How to remove all occurences?
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
1 answer 9 views
9 views asked Oct 24, 2020 Shaad Sh 800 points
0 votes
1 answer 18 views
18 views
Problem: Given that play_list has been defined to be a list, write a statement that sorts the list?
asked Mar 9, 2020 ArifulIslam 5.6k points
1 vote
1 answer 37 views
37 views
Problem: Hello guys, I’ve got a python list full of data. I want to print them reversely. The only condition that has to follow is to use a for-loop in the program. I know there could be several ways to do that but I want for-loop to do that. ... you've any suggestion in this regard? Please, keep your answer as simple as possible. It would be helpful for me to understand well. Thanks.
asked Jun 2, 2020 adamSw 11.3k points