The inspiration to build this project was the curiosity of how can we sort a list.

The major function of this is to arrange our list in an ascending or a descending order as per the user instructions and sort our list.

I used the programming language Python to solve this problem.

I was stuck with the concept initially because I wanted to include both ascending and descending order sorting but later solved it, which was quite challenging.

Accomplishments I would be proud of would include the fact that I completed and cracked this challenge.

We learnt how we can sort a simple list in Python.

I believe we can use various techniques of sorting a list like bubble sort, selection sort , quick sort etc to solve the same problem. Here I have used simple sorting technique.

Code block is given below: def sortSecond(val): return val[1]

list1 to demonstrate the use of sorting

list1 = [(1, 3), (3, 5), (5, 7)]

list1.sort(key = sortSecond) #sorting list in ascending order print(list1)

list1.sort(key = sortSecond, reverse = True) #sorting the list in decsending order print(list1)

Built With

Share this project:

Updates