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 want to code the apply_method function: class A: def calc(self, num): return num
I have a decorated function (simplified version): class Memoize: def __init__(self, function): self.function =
Here is my search function : class Ads extends Controller { public function search($format='velos',
My class function alway need do something before like this (Python): class X: def
class my_class def is_same(self, arg1, arg2): return arg1 == arg2 def a_function(self): if is_same('a',
Given the following: class MyClass: def __init__(self, someval): self.someval = someval def get_a_function(self): def
I've created a web framework that uses the following function: def to_class(text) text.capitalize text.gsub(/(_|-)/,
I have a Exception base class which defines a stream function: class Exception {
I want to do the equivalent of the following VB in c# Function([class]) hello
Hi i can define functions like this for el: <function> <function-name>areAllGranted</function-name> <function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class> <function-signature>boolean areAllGranted(java.lang.String)</function-signature>

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.