Python List Reverse Function

Question:

Python Novice. Need to create a list which is a reverse of the previous list. Ran the follow code:

list_10 = [1,10,20,4,40,14]
list_11 = list_10.reverse()
print (list_11)

I get an output that says “None”

Any suggestions?

Asked By: Ish

||

Answers:

Because reverse() reverses the list in place, it returns none.

Try this.

list_10 = [1,10,20,4,40,14]
list_10.reverse()
list_11 = list_10
Answered By: Gilseung Ahn
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.