Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1041023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:17:50+00:00 2026-05-16T15:17:50+00:00

The function class: def play_best_hand(hand, wordDict): tempHand = hand.copy() points = 0 for word

  • 0

The function class:

def play_best_hand(hand, wordDict):

tempHand = hand.copy()
points = 0
for word in wordDict:
    for letter in word:
        if letter in hand:
            tempHand[letter] = tempHand[letter] - 1 
            if tempHand[letter] < 0:
                return False
            if wordDict[word] > points:
                bestWord == word
                points = wordDict[word]
return bestWord

Here is my trackback error. Line 209 corresponds to the line ‘for word in wordDict’

 Traceback (most recent call last):
    File "ps6.py", line 323, in <module>
    play_game(word_list)
  File "ps6.py", line 307, in play_game
    play_hand(hand.copy(), word_list)
  File "ps6.py", line 257, in play_hand
    guess = play_best_hand(hand, wordDict)
  File "ps6.py", line 209, in play_best_hand
    for word in wordDict:
TypeError: 'NoneType' object is not iterable
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:17:50+00:00Added an answer on May 16, 2026 at 3:17 pm

    This means that the variable wordDict is None instead of a dictionary. This means there’s an error in the function that calls play_best_hand. Probably, you forget to return a value in a function, so it returns None?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript function (class) that takes a function reference as one paremter.
I have a base class with an optional virtual function class Base { virtual
I'm looking for a PHP library/function/class which can create Identicon s.
What does the following mean? Class.Function(variable := 1 + 1) What is this operator
I have a function that looks like this class NSNode { function insertAfter(NSNode $node)
I have a function inside a class that returns a reference to a member
Within my a certain function of a class, I need to use setInterval to
I am trying to pass a member function within a class to a function
I have this method in my db class public function query($queryString) { if (!$this->_connected)
I have a bunch of sorted lists of objects, and a comparison function class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.