Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help appreciated
#8
(Aug-22-2019, 06:15 AM)perfringo Wrote:
>>> nums = [110, 201, 305]
>>> min(nums, key=lambda num: num % 100)
201

I'm not understanding this part.. how this min works here? say for iteration 1, it will do like min([110,201,305],key=10).. is my understanding right. Please clarify me and why we need key here? I mess up Sick

Also, how 201 is min when 110 is already there? I feel I'm over looking
Reply


Messages In This Thread
Help appreciated - by elperex - Aug-20-2019, 11:52 AM
RE: Help appreciated - by wavic - Aug-20-2019, 03:03 PM
RE: Help appreciated - by perfringo - Aug-21-2019, 07:22 AM
RE: Help appreciated - by millpond - Aug-22-2019, 04:31 AM
RE: Help appreciated - by Malt - Aug-22-2019, 05:24 AM
RE: Help appreciated - by ThomasL - Aug-22-2019, 05:28 AM
RE: Help appreciated - by perfringo - Aug-22-2019, 06:15 AM
RE: Help appreciated - by Malt - Aug-22-2019, 08:33 AM
RE: Help appreciated - by perfringo - Aug-22-2019, 09:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Any help would be appreciated tegtheWegg 1 1,754 Feb-10-2021, 12:52 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020