A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 4 years ago

PS6#3.I am just blanking,forgetting everything and with dictionary trouble.Help with 'get_words_to_points(word_list),please. http://codepad.org/bFrPW3dS There is some semblance of a start.Just cannot remember the syntax rules of everything and when certain attributes and lines are necessary(yes,the most basic bits).Yes,I read but it doesn't make sense as a whole.I might go back and grab here and there but that is not great.Sorry to be such a dope.Also,is this all there is to update? http://codepad.org/SJSm2WI8 Thank you

  • This Question is Closed
  1. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    def get_words_to_points(): get_points_dict = {} print 'Loading point values of words ...' ## cycles through the wordlist creating a dictionary ## with the word as the key and the point value as the entry for index in range(len(word_list)): get_points_dict[word_list[index]] = get_word_score(word_list[index],HAND_SIZE) return get_points_dict I think this works

  2. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Hey,thanks for the response.Looks OK(just changed my own notation)but I am not in position to question another. That is sort of the method from earlier, have you tried using any of the shortcut tools for dictionaries? Wondering if those could be useful/better or even applicable. Also,did you check out my second link for the update using the dictionary? Seems stupid and wrong but maybe.

  3. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    what are the dictionary shortcut tools? you could do it when you first load the words: http://dpaste.com/695441/ why do you think your updated is_valid_word function is wrong? does it work? here is mine: http://dpaste.com/695442/

  4. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Don't know if updated is_valid_word works.Honestly,one big issue is I just lose track of variables and what is temp and what is Python language.Just overwhelmed to try to just test this piece and figured someone could tell with a look. So when you are looking for strings in a dictionary, you can just name the dictionary, no need to name keys or values?I see in yours you just have 'word' and points_dict and I had points_dict(keys) thinking it was only looking through those and trying to be careful.

  5. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i think keys is the default if not specified - don't know where i read that, probably somewhere in the docs didn't you test it before you posted it? tsk, tsk looks like it might work to me. here is a test i wrote for mine: http://dpaste.com/695491/

  6. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Here are some pieces of code for parts of the problem.Any scoldings on all the things I left out or are needed in there are welcome.I am not sure of the syntax and use in certain cases(and I looked around),especially line 29 and 25,trying to pick out the key and add it to the list and then sort it pick out last(highest value/score).But I have confused how to use the functions.I changed my approach to the problem after being sort of through it.Here is the link. http://codepad.org/7O7c9Toh

  7. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    lines 23-31 will find the highest score but doesn't preserve the word itself. I think you need to use itertools permutations with points_dict - consider the hand 'dbac' it.combinations won't produce the word bad but permutations will http://dpaste.com/696045/

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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.