Finished pb set 5. Would like some suggestions/ critique. http://codepad.org/yYftkkcz Thanks in advance!
at line 67&167 - the lower() method is available to all string objects --> you can just use - word.lower() line 69 - word_low[i] is already a string you don't have to turn it into one line 126, update_hand: the instructions say to assume that hand contains all the letters in word they also say that the function should not mutate the hand here is an alternate implementation - http://dpaste.com/670535/ line 168/169: if word is not in word list you could immediately return False http://dpaste.com/670542/ if an expression evaluates to a boolean you can just use it - you shouldn't compare it to True or False. For example lines 246, 247 should just be: if is_valid_word(word, hand, word_list):
Thanks for the suggestions! I have a bad tendency to keep to my MATLAB script style...
i didn't test it but it all looked like it would work ... i didn't look at play hand or play game very hard . http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html .
Thanks for that link bwCA!
Join our real-time social learning platform and learn together with your friends!