Psy5 Update_Hand Bug I'm dealing with a bug for the update_hand function. I've simplified my code for the play_hand function so that it is now only deleting letters and not replacing them. If there is a letter in the original hand which appears more than once, I wind up deleting both letters from the hand during update_hand even if I've only used one of them in the word. For example, if the hand was (p i l l e q r) and I enter 'pile', update_hand will erase both l's and return the hand (q r). Anyone have suggestions: http://dpaste.com/577371/
Del will remove the key from the dictionary. Just try in IDLE with a very simple dictionary. You want to subtract one from the value like this: http://dpaste.com/577496/
Thanks mk95! I was just thinking about how I need to delete from the value, not the key but I hadn't gotten my head around how I was going to do it. This is really helpful.
No problem. I think dictionaries are kind of confusing, so usually just test the function on very simple dict since it's not always clear what it's doing from the description. Also, make sure to mark your question as solved.
Join our real-time social learning platform and learn together with your friends!