Tuesday, December 29, 2020

List-Sort and sorted

Sorted

Sorted takes the list as argument and returns a new sorted list, with the original list unaltered.
 
Sort method sorts the data in place.
 

Reverse and Reversed list:

 b=[10,20,30,40,50]

for index in reversed(b):

        print(index) 

50

40

30

20

10 

returns a new reversed list

b.reverse()  // reverses the list in-place

print(b)    //[50,40,30,20,10]

 

No comments:

Post a Comment

Anaconda Installation

In this post we will discuss about Anaconda and its installation. Anaconda comes with number of applications(jupyter notebook included), dat...