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

  • Home
  • SEARCH
  • 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 8228781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:34:41+00:00 2026-06-07T16:34:41+00:00

I am coding (or rather trying to code) a game in python and I

  • 0

I am coding (or rather trying to code) a game in python and I have following problem.
When I use loop this loop that should give me values from dictionaries(x.chest etc., every dict looks like that {'fire': 0.0, 'water': 0.0, 'acid': 0.0,'air': 0.0}):

for damag in (x.chest, x.stomach, x.lhand, x.rhand, x.lleg, x.rleg):
    for value in damag.values():
        print(value)

i get

AttributeError: 'function' object has no attribute 'values'

If i change the code to:

for damag in (x.chest, x.stomach, x.lhand, x.rhand, x.lleg, x.rleg):
    for value in damag().values():
        print(value)

it works but only partially. It returns values from x.chest and then gives an error:

TypeError: 'dict' object is not callable

I think that the solution to this problem must be easy, but there is flaw in my thinking so I can’t find it. I can solve this by doing separate loop for each dictionary but I think that this is not the best idea.

  • 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-06-07T16:34:43+00:00Added an answer on June 7, 2026 at 4:34 pm

    Clearly, your list of x attributes is not homogeneous; at least one of the attributes you list there is a function, while at least one other is a dict.

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

Sidebar

Related Questions

I'm trying to get into the habit of coding to an interface rather than
I'm trying to update some existing code that normally runs a Perl script which
i found this code online and im trying to compile it, but gcc keeps
I have a code that looks like (more or less) : public void INeedHolidaysNow(double[,]){
Not a specific code question, but more of a general coding question. I'm trying
I'm trying to use regular expressions to remove certain blocks of coding from a
I think this question is more of a coding style rather than technical issue.
I decided I'd like to use django's model system rather than coding raw SQL
My problem is the following. I have a method which simply takes an XML
At my place of work, we have an ASP.NET page that uses the following

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.