Issue
I'm trying to reverse a integer and using the below code but the resultant list value in None. How much can we put in a list? The code:
int_a= [1,2,3,4,5,6]
rev_word = int_a.split()
rev_number = rev_number.reverse()
rev_number= "".join(rev)
it return the TypeError. Why?
Solution
Here is the short and optimal way to reverse a list in python:
int_a= [1,2,3,4,5,6]
int_a = int_a[::-1]
Answered By - Muhammad Abbas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.