Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Kevin0008

  • one year ago

In the lec9 ,there is a function sort(L,it = lambda x,y:x<y): I dont understand this defination ,can anyone help me?

  • This Question is Open
  1. bwCA
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    which course? OCW 2008, 2011 ? EDx2013? use a code pasting site and post the whole function along with any lines that call it. http://dpaste,com

  2. msmithhnova
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Without more it has hard to say exactly but I am guess the lambda part is the problem. It creates an anonymous (no name) function that takes two arguments and returns true or false. Here is an example. >>> it = lambda x,y:x<y >>> it <function <lambda> at 0x02974A30> >>> it(3, 4) True >>> it(4,3) False

  3. rsmith6559
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    sort( L, it = lambda x,y:x<y ): looks to be a sort function being passed either a list, or a list and a comparison function that returns either True of False ( equal should be interesting! ). If no comparison function is passed, the lambda will be used.

  4. Not the answer you are looking for?
    Search for more explanations.

    Search OpenStudy
    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.