TypeError: 'float' object has no attribute 'getitem' What does this mean ???
Inshu
0
Newbie Poster
Recommended Answers
Jump to PostThis code is not indented, so it can't run. Notice that the power operator is
**
, not^
, python is not latex. Also when there is an error, python outputs a long message, starting with the word Traceback (most recent call last). To find the error, you must analyze this …
Jump to PostOK, I can see your getting flustered, so let's back away from the code for a bit and consider the overall problem you are trying to solve. Just what is the program supposed to compute, and how would you do it by hand if you had to? I don't mean …
Jump to PostAh, this does clarify things somewhat. OK, then.
I think you'll want to fix
calcdist()
first; divorce it from the data stream as it is and have it take two three-tuples as it's argument:def (a, b): return sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2 + (a[2]-z[2])**2)
Better still …
All 11 Replies
Gribouillis
1,391
Programming Explorer
Team Colleague
Inshu
0
Newbie Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
Inshu
0
Newbie Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
Inshu
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
Inshu
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
Inshu
0
Newbie Poster
Lardmeister
461
Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.