Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

frankdpnw

Exercise 3.4 people function I have spent a fair amount of time on trying to get this function to work and now it seems as if it does. It returns the correct answer but I am not convinced that it is the best way to implement it. def people(age): n1=[] for name, xxx in combined_dict.iteritems(): if age==xxx: n1.append(name) return n1 Thanks

  • one year ago
  • one year ago

  • This Question is Open
  1. Screech
    Best Response
    You've already chosen the best response.
    Medals 2

    Like many of the exercises, insufficient thought was given when it was designed. I used similar technique and thought, too, that it was just plain silly to do it that way.

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

    Thanks Screech,

    • one year ago
  3. andrew.m.higgs
    Best Response
    You've already chosen the best response.
    Medals 1

    We need to remember that these exercises are not always going to be the optimal way to do something but rather are designed to test what w know about something. In this case the test its about using dictionaries. How would you improve the way the question is asked?

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

    I'm in the MOOC "Gentle Python" course. Often I'm torn on how to do these lessons. I assume we should try to become deeply familiar with Python basics as much as possible. Thus, I generally try to complete these MIT assignments using what we've learned in Gentle Python rather than jumping ahead to investigate new Python techniques. For example, I notice that frankdpnw used "iteritems()" to write code, which is ahead of me. I was able to finish the assignment without using that function but at the same time I read about it in Python documents and practiced using it just to have an understanding.

    • one year ago
    • Attachments:

See more questions >>>

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.