[Tutor] New at Python

Danny Yoo dyoo at hashcollision.org
Mon Oct 6 02:15:27 CEST 2014


On Sun, Oct 5, 2014 at 3:40 PM, Mike Spaulding <spauldingfamily at twc.com> wrote:
> Given that n refers to a positive int use a while loop to compute the sum of
> the cubes of the first n counting numbers, and associate this value with
> total . Use no variables  other than n , k , and total .
>
> Hi, I am really a rookie at Python and I am just learning some of the
> language and some of the functions etc.  I am using Pearson’s Programming
> lab and the accompanying online book.  The biggest problem that I am having
> is trying to figure out how to start off on problems such as the one above.


Hi Mike,

If you can point out previous exercises that you've done, that may
help us point out similarities between the things you've done before,
and this particular problem.  (The material you're pointing out is not
freely available, so I can not search for it not see what problems
preceded the one you're working on now.)


Generally, a problem solving strategy such as:

    http://en.wikipedia.org/wiki/How_to_Solve_It

should be helpful in breaking this down.


R. Alan Monroe suggests that you try it "by hand" first.  This is a
good approach to start: you need to _understand_ what's being asked
before trying to instruct a computer by hand.  Do you understand the
problem statement?  What is the "input", and what is the expected
"output"?

Let's get that cleared up before talking about the code.


Good luck!


More information about the Tutor mailing list