Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 19 Online
OpenStudy (anonymous):

I'm having trouble on PS6. I wrote the following code: def get_words_to_points(word_list): """ Return a dict that maps every word in word_list to its point value. """ for word in word_list: score = get_word_score(word, HAND_SIZE, 1) points_dict[word] = score return This totally bogs down my computer and even if I interrupt the program, IDLE continues running very slowly until I close it and restart. Am I doing something wrong creating the dictionary? Would I be better off not calling get_word_score and doing this within this function?

OpenStudy (anonymous):

By the way, 1 is the time used to determine score. I don't want a score affected by time so I set the time as 1. Also, points_dict is a global dictionary

OpenStudy (anonymous):

I was testing it with a counter and breaking it up every 1000 entries or so with raw_input and it seemed to be very slow. I wrote the program without calling get_word_score and it was very fast. I rewrote it again with the above code and it is working now. Not sure what the problem may have been.

OpenStudy (anonymous):

if you use a code pasting site, it is easier for the rest of us to comment. when you post functions you are having a problem with, include the code that calls it and anything it relies on (constants, other functions etc) http:\\dpaste.com http:\\pastebin.com http:\\codepad.org

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!