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

varatiki

In Problem Set 3, Problem 6A: I can't get the provided perm.py file to return anything no matter what I pass it. I have also tried pasting its code into my program... still nothing. It doesn't seem to populate a list. Should it return a list, 'items', 'handlist', or 'toret', because if so, none of these are coming out of it. Relevant snippets from my code: from perm import * #I have also tried copy/pasting everything from this file into my program and calling it locally get_perms(hand, letters_remaining) xuniqueCombinations(hand, letters_remaining) #before and after these calls handlist = [], toret = [], & items =[]... nothing changes. Am I broke, or might it be the perm.py file?

  • one year ago
  • one year ago

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

    you would need something along the lines of toret = get_perms(hand, letters_remaining) so you can store the result that is returned by the function

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

    Oops. That was an obvious omission on my part. However, when that is included in the code, it still yields an empty list of " toret = [''] ".

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

    I have the following to start 6A for i in range(1,HAND_SIZE+1): perm_list=get_perms(hand,i) As long as the "hand" dictionary has something in it, perm_list should contain all combinations of the letters in hand starting at size 1 up to hand_size.

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

    To clarify, if hand is {'a':2,'c':2,'t':2} then on the first iteration perm_list will be ['a', 'a', 'c', 'c', 't', 't'].

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

    Awesome. I have movement! Will give it a shot moving forward with debugging and will reply if I get stuck again. Thanks!

    • 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.