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 7021319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:26:03+00:00 2026-05-27T23:26:03+00:00

I’m sure all experienced Python programmers know a simple, elegant way to do this.

  • 0

I’m sure all experienced Python programmers know a simple, elegant way to do this. Unfortunately, at my beginner’s level, I do not.

Anyway, I’m currently attempting to modify some AI scripts for a game program written by others. I’m looking for a way to extract the numeric elements from an existing object and then add all of those elements together.

The number of elements in the object will vary, but will usually be no more then ten (10).

The elements in the object will always be ‘floats’.

So, for i in obj:

How should I proceed to extract all of the elements from the existing object and then add them together to return a new ‘float’ number?

  • 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-27T23:26:04+00:00Added an answer on May 27, 2026 at 11:26 pm

    You can use sum(iterable) to add up all the items in a tuple or list.

    sum([1,2,3]) returns 6, for example.

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

Sidebar

Related Questions

I'm sure we all have received the wonderfully vague Object reference not set to
What is the best way to make sure that all the environment variables I
I'm sure we've all done this before: <a id=232 rel=link_to_user name=user_details class=list hoverable clickable
I'm not sure what could be causing this, but I installed GhostDoc and the
I'm not sure, if this is really a question or more an observation -
Okay guys, I'm sure this has a very simple solution but my searches are
Maintaining unit tests is difficult. I am sure that we all have experienced a
Am not sure how to ask this question but for most of you more
I am not sure this is possible with SQL (say we are executing on
Not sure if this is related to this question (seems to be but I

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.