Learner looking for assistance

Ben Finney ben+python at benfinney.id.au
Mon Apr 14 04:11:19 EDT 2014


Anthony Smith <jackie.walkabout at gmail.com> writes:

> the calc_total does not return a estimated_total_weight
>
> if add the estimated_total_weight the rest of the code works 
>
> I am at a lose as to why ?????

When it's too confusing, simplify. The code you present is fine, but is
more complex than it needs to be for the specific problem.

Also, it's not complete: it appears to be part of some larger program
that we don't have. And, it appears to have suffered re-formatting when
you put it in your message, so it won't run. (Post only in plain text,
not HTML; and copy-paste the code in plain text.)

So: start simple, make something you understand, then gradually build it
up until the point where it exhibits the behaviour you're confused by.

Then, show that simple-as-possible-but-no-simpler version here, complete
with the input you're using and the resulting output.

    <URL:http://www.sscce.org/>

You may find that this process gives you enough understanding that you
are then able to solve the problem. Great! But, even if not, we'll need
you to go through that process so we can understand. Feel free to post
the simple version here if it still leaves you confused.

-- 
 \     “Nothing worth saying is inoffensive to everyone. Nothing worth |
  `\    saying will fail to make you enemies. And nothing worth saying |
_o__)            will not produce a confrontation.” —Johann Hari, 2011 |
Ben Finney




More information about the Python-list mailing list