[Tutor] import values, calculate distance

Dave Angel davea at davea.name
Thu Aug 21 11:19:13 CEST 2014


LN A-go-go <lnartist at yahoo.com.dmarc.invalid> Wrote in message:
>

Thanks for a better subject line, and for starting a new thread
 when you have a substantially new question. . Please use text
 mail instead of html.  The html you're using can cause several
 different problems. And please do interleaved quoting,  not
 top-posting. (I can't do likewise,  since your html doesn’t quote
 at all with my mail reader)

Also specify in the first message of any thread what python
 version and os version you're using.

You say 'at times, I can't even save it'
Sounds like you need to learn your text editor better. Or switch
 to a better one if it's just flaky.

You say 'it just isn't right'
That's not much of an error message.  You need to make it easier
 for us to help you. Did you get a traceback? Quote the whole
 thing.   Did you get the wrong results? Tell us what you expected
 and show us what you got instead.

So, without some specific questions,  I'll comment on the code.
 Some of these changes may help you narrow down the problem.
 

You only seem to be indenting 2 spaces,  but that may be an html
 artifact,  see above. Many htn
ml to text converters throw out half the spaces.

You have way too much code at top level,  rather than functions. 

In distance (), the line starting DP.append does not line up with
 the preceding line.  All the lines of a given block must line up
 exactly. I suppose you may be mixing spaces and tabs, which is
 very dangerous.  Tell your editor to convert any existing tabs to
 spaces,  then tell it to expand all future use of the tab key to
 4 spaces.

You define dist as a global and have an argument for it in
 function distance. I suspect it should simply be a local in
 distance ()

I don't spot any calls to distance or switch. 

I'm sure there are other things,  but without running it, this is
 enough for now.

-- 
DaveA



More information about the Tutor mailing list