Python Tutorials - List Sorting | sort method

  Рет қаралды 94,315

Amulya's Academy

Amulya's Academy

Күн бұрын

Пікірлер: 120
@fatinishraqprapya3139
@fatinishraqprapya3139 3 жыл бұрын
This is one of the best helpful video for the beginners who are learning Python.
@sushilkumar-ef7gh
@sushilkumar-ef7gh 6 жыл бұрын
I have to say that you have made coding more interesting then ever for me ....Thanks a lot
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Welcome:)
@babyfox205
@babyfox205 5 жыл бұрын
great explanation of the 'key' for sorting, your explanation was the best of all 5-6 that I've seen today and were unable to really understand why we can put any function into the key. Thank you!
@denizyarar4781
@denizyarar4781 3 жыл бұрын
thank you i'm a year 11 student writing code for an NEA and this vid is a lifesaver
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you :)
@fun-ih5sc
@fun-ih5sc 5 жыл бұрын
9:18 . * When we call the userdefine function we are not passing any argument as but when you define the function it is taking one argument .How is it working. * key=SortBySec, here how the argument in function defination "Element" is pointing toward every index of a list Thanks & Regards Aditya
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
you should mention function name as key, no need to mention arguments. when you define key function it should contain only one parameter, if it contains more we will get error. when we use sort function it will take the first value of list and compare it with second element and based on the comparison it will sort the list. [when key is not mentioned]. when key is mentioned then instead of comparing first element with second, it will pass that first element to that function, next second element to that function later based on that function result it will sort the list. :)
@qzorn4440
@qzorn4440 6 жыл бұрын
this is sooo relaxing python information. I listen to your video on my coffee break to relax. S*) thanks
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Welcome :)
@vishnubhardwaj2595
@vishnubhardwaj2595 3 жыл бұрын
your voice is really very soothing and video is very helpful.
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you 😊
@trishulsingh2907
@trishulsingh2907 3 жыл бұрын
Your channel is Underrated . Keep going one day you will reach 10k Subscribers .
@angelomichel6074
@angelomichel6074 4 жыл бұрын
this information is so satisfying !!!Thank you so much Amuls Academy
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Glad you liked it!
@sangeethaagoudar2175
@sangeethaagoudar2175 2 жыл бұрын
This is one of the best video of knowing exactly how the nested list worked with sort .Thank you so much 😊
@alimujtaba1208
@alimujtaba1208 3 жыл бұрын
your teaching method is very best i satisfier
@HarshRaj-bm9eg
@HarshRaj-bm9eg 6 жыл бұрын
mam i am so so so thankful to u. you cannot even imagine what you are to me
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Welcome:)
@josephdzn9868
@josephdzn9868 5 жыл бұрын
good explanation. 2nd example can also be done by: list2.sort(key=lambda x: x[1])
@ilzz9856
@ilzz9856 4 жыл бұрын
Hi bro can u explain working of that expression?
@josephdzn9868
@josephdzn9868 4 жыл бұрын
I am not an expert here (still learning) but you can think of lambda as a throw away function. No need to define a separate function but you can encapsulate expressions (and arguments) using lambda - if that makes sense. Amulya's channel clearly explains the Lamdba function, check that out.
@mananbhatia9242
@mananbhatia9242 2 жыл бұрын
how we can do to descending order using this function?
@Suhail_202k
@Suhail_202k Жыл бұрын
Really one of the best videos on KZbin hatsoff ,great explanation mam thanks for your efforts,i hope you will do more videos ❤
@nagapurisandeep2289
@nagapurisandeep2289 3 жыл бұрын
Your explanation is good mam.
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you 😊
@sairamnagarajan8289
@sairamnagarajan8289 5 жыл бұрын
Simplistic explanation. Thanks for your effort.
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
My Pleasure :)
@zhimwar1367
@zhimwar1367 5 жыл бұрын
Thank you so much for sharing this. U have solved one big question in head for long time.
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Pleasure :) And that is ?
@krishk4870
@krishk4870 5 жыл бұрын
hey i got doubt pls clear it... that in 7:55 how the fucn (sortbysec) is works its just return the parameter(element's) first indexing position,that how could sort the list regards with sec value of sublist of list2 ????????? pls xplain the key fuction def sortbysec() plsssssssss amul !!!!!!!!!!
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
key function serves as a key for the sort comparison, it won't sort the list. "key" function transforms each element before comparison, next based on that transformed value sort() will sort the list. :)
@gani3676
@gani3676 6 жыл бұрын
Hi Amul, Will be waiting for continuous video. Thanks
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Thank you:)
@ilzz9856
@ilzz9856 4 жыл бұрын
In the video you done ascending order through first element and by second element . How can we make descending order in that list with second elements?
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
take reverse=True :)
@steveaman5126
@steveaman5126 3 жыл бұрын
nice in-depth knowledge
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you 😊
@abdullakhan4632
@abdullakhan4632 4 жыл бұрын
very good. i like your explanation. grate 👍👍👍
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Thanks! 😃
@mohsharma3937
@mohsharma3937 4 жыл бұрын
THANK YOU SO MUCH MA'AM YOU CLEARED MY DOUBT
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
It's my pleasure : )
@itachi99887
@itachi99887 Жыл бұрын
Do you have any video on how to sort tuple inside list . For eg [(as,1),(cs,2),(bs,6)] how to sort the key value in ascending order. If you have please give the link . Thank you
@HarshRaj-bm9eg
@HarshRaj-bm9eg 6 жыл бұрын
thank you very much for making such a very beautiful video based on python
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Thank you:) Keep Learning
@sanketh768
@sanketh768 4 жыл бұрын
Thanks for the video. But had 1 doubt which is still unclear def sortbysec(element):# accepts list as a parameter or argument return element[1] list=[(1,16),(1,2),(2,5)] list.sort(key=sortbysec)# my doubt is sort by sec is not taking any parameter as per the signature of this function. # we are not passing any argument to the sortbysec function i mean list2=sortbysec(list) # passing list as arguments Would greatly appreciate your help
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
No need to pass any parameter to key function :) You are calling list.sort(key) so whatever you will do with sort() will apply on list. :)
@sanketh768
@sanketh768 4 жыл бұрын
@@AmulsAcademy Thank you for the response
@saumyachaudhary3983
@saumyachaudhary3983 4 жыл бұрын
very good explanation
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Thank you :)
@spark561
@spark561 6 жыл бұрын
This is a great video and more useful for us
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Thank you :)
@spark561
@spark561 6 жыл бұрын
@@AmulsAcademy well come
@gouthamrajesh2745
@gouthamrajesh2745 4 жыл бұрын
Helped me in python project
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Glad to hear that :)
@belalibrahim3812
@belalibrahim3812 5 жыл бұрын
Its soo helpful 😊
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@miftahshidqirabbani6489
@miftahshidqirabbani6489 4 жыл бұрын
Thanks dude. You helped me to get out of this :)
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Glad to hear that :)
@debojitmandal8670
@debojitmandal8670 3 жыл бұрын
Mam can you sort length of a string and pritn the longest word
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
We can try :)
@gauravpatil7977
@gauravpatil7977 3 жыл бұрын
how come index of second element is one in nested list? it should be element[0][1], shouldn't it ?
@AkashSingha
@AkashSingha 5 жыл бұрын
Thank you very Much mam it helps me a lot.
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Pleasure :)
@HarshRaj-bm9eg
@HarshRaj-bm9eg 6 жыл бұрын
mam one more thing i want to say to you is that can you tell me that from where can i get questions based on python for beginners as i am new to program. this is the first time i am learning any language and this is the python
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
google it, you can start with basic programs:)
@allenjr4978
@allenjr4978 3 жыл бұрын
The best ever
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you 😊
@swethamk5925
@swethamk5925 3 жыл бұрын
How to get a list input.. Like this [1,2,3,4] as an input and print it like [4,3,2,1]
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
You want to reverse the list or want to sort?
@swethamk5925
@swethamk5925 3 жыл бұрын
I want to reverse the list
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
list1.sort(reverse=True)
@mominumar3388
@mominumar3388 6 жыл бұрын
How can we sort a list containing numbers as well as characters??
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
In python 3 it will give error But you can separately sort characters and numbers then you can append it to list. c = ['s', 'a',2 , 'j', 9, 'e', 11, 't', 'k', 12, 'q'] c = sorted([i for i in c if not str(i).isdigit()]) + sorted([i for i in c if str(i).isdigit()]) print(c) :)
@1mol831
@1mol831 3 жыл бұрын
Thanks, though I still want to learn how I could sort by frequency. Without using a while loop with a dictionary..
@Sandeep0917
@Sandeep0917 3 жыл бұрын
can u solve this by using for loop
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Give me the program, I will try :)
@charancharan2417
@charancharan2417 6 жыл бұрын
Hi mam Will you provide online training or classroom training for python....???? May I know if you are doing training
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
No sorry:)
@bhagwatimehra4738
@bhagwatimehra4738 2 жыл бұрын
How to display a list in ascending and descending order using a str value
@vignesh3851
@vignesh3851 Жыл бұрын
Your voice is melted me 🥶
@tanmoysardar3908
@tanmoysardar3908 6 жыл бұрын
maam i am Tanmoy have been waiting for u since last week plz maam its very urgent i want to study that python graphics part ...i have subscribed your channel and also downloaded all of your video ..please maam make that video
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Hi Sure. But i need some time:)
@tanmoysardar3908
@tanmoysardar3908 6 жыл бұрын
maam kya aap bata sakti how much you need maam isliye bol raha hu ki ek project submit karna tha thoda help ho jata
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Project submit kab karna hai?? i need minimum 2 weeks. :)
@tanmoysardar3908
@tanmoysardar3908 6 жыл бұрын
4th of July maam
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Ohhh...I guess i can't upload so early:)
@Aivin
@Aivin 4 жыл бұрын
helpful helpful helpful did i forget to say helpful?
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Thank you :)
@patelhardik2505
@patelhardik2505 4 жыл бұрын
thank you.
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Welcome :)
@Sanjaykumar-xr8rz
@Sanjaykumar-xr8rz 5 жыл бұрын
without function use kiye kro list ko assending order main
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
You mean to say without built_in functions ?
@tanaymajumder9220
@tanaymajumder9220 5 жыл бұрын
Amuls Academy please guide me to do without using sort function
@deepuvarma9459
@deepuvarma9459 6 жыл бұрын
good one
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
Thank you:)
@maltesh105joshi
@maltesh105joshi Жыл бұрын
I have xml and i can sort within first child only. but it will through an error when the line have commented in my 1st child. it works fine if there is NO comments. can you help me here CODE root = tree.getroot() for c in root: c[:] = sorted(c, key=lambda child: (child.tag,child.get('name'))) xmlstr = ET.tostring(root, encoding="utf-8", method="xml") print(xmlstr.decode("utf-8")) ERROR c[:] = sorted(c, key=lambda child: (child.tag,child.get('name'))) TypeError: '
@abhishekpathak9454
@abhishekpathak9454 4 жыл бұрын
Hllw mam my question is that how to get sum of sub list..?? Tell me plzz😓
@Aivin
@Aivin 4 жыл бұрын
sum(list[sublist]) i think
@madras.mp424
@madras.mp424 3 жыл бұрын
Where the without using built in function ?
@charancharan2417
@charancharan2417 6 жыл бұрын
Hi Please upload Django course for freshers
@AmulsAcademy
@AmulsAcademy 6 жыл бұрын
For now i can't. But will do tutorials on django:)
@mathemediaworld9711
@mathemediaworld9711 5 жыл бұрын
Without using any build dunction
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
You can use selection sort or other sorting algorithms for that :)
@subrinalazad3215
@subrinalazad3215 4 жыл бұрын
Thank you
@sigdyxc2658
@sigdyxc2658 3 жыл бұрын
I like your voice
@Ganga_BE
@Ganga_BE 2 жыл бұрын
Sis. Input=1234, output=10203040 I want this program sis
@miraatif9945
@miraatif9945 5 жыл бұрын
Thanks mam
@abhishekjaiswal3821
@abhishekjaiswal3821 4 жыл бұрын
thnx
@nadeeshandilusha1934
@nadeeshandilusha1934 3 жыл бұрын
🖤🖤
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
😊
@amirsharifi8837
@amirsharifi8837 3 жыл бұрын
wow!
@mathemediaworld9711
@mathemediaworld9711 5 жыл бұрын
Do it
@sensei_kail1109
@sensei_kail1109 3 жыл бұрын
nice india
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you :)
@TheNikhilify
@TheNikhilify 3 жыл бұрын
Virginal list
@sahals8564
@sahals8564 4 жыл бұрын
Thank you
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
You're welcome :)
Python Tutorials - Bubble Sort Program
17:03
Amulya's Academy
Рет қаралды 103 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 10 МЛН
Python Tutorials - String Methods | translate() | maketrans()
16:26
Amulya's Academy
Рет қаралды 40 М.
Learn Merge Sort in 13 minutes 🔪
13:45
Bro Code
Рет қаралды 357 М.
Python Tutorial - Map and Lambda Function
10:34
Amulya's Academy
Рет қаралды 92 М.
Python sort a list of dictionaries
7:10
Python 360
Рет қаралды 3,1 М.
Python Tutorial - Filter and Reduce Function
11:49
Amulya's Academy
Рет қаралды 45 М.
Dictionary in Python
12:24
Telusko
Рет қаралды 1,4 МЛН
Sorting Algorithms Explained Visually
9:01
Beyond Fireship
Рет қаралды 556 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 10 МЛН