[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sum of few numbers by using for and range

On 18/02/19 8:32 AM, Chris Angelico wrote:
> On Mon, Feb 18, 2019 at 6:12 AM DL Neil <PythonList at danceswithmice.info> wrote:
>> The reason this course caught my attention (and which is relevant to
>> you, per Chris' and Dennis' recent advice) is that the course revolves
>> around an 'active textbook'. This intersperses learning material with
>> mastery exercises, and pertinently, uses a 'widget' which steps through
>> code, line-by-line, showing exactly what is happening to each variable.
>> I was impressed!
> That sounds like an EXCELLENT way to do the second part - running the
> code to see if you were right. I would still recommend doing it 100%
> manually first, *writing down* your expectations, and only *then*
> letting the computer do it. It's easy to watch the computer do
> something and go "yes, of course that's what happens", but to still
> not be able to replicate it yourself. True comprehension means being
> able to predict what will happen.
> Consider it like a falsifiable hypothesis in scientific research. "I
> expect that, when I do X, Y, and Z, the result will be Q." Then you
> actually perform those steps, and see what the result is. Were you
> right? If not, how do you modify your expectations/hypothesis to
> correct it? It's the last step that is the most interesting, because
> that's where you truly learn. (And sometimes, that learning is
> expanding the corpus of human knowledge. It's only when you disprove
> your expectations that you can begin to pin down something like "oh so
> time flows at different rates depending on gravity" or "huh, so it
> turns out black-body radiation doesn't behave the way all the math
> said it would".)


For reference Chris (et al):
The 'active textbook' offers 'windows' which seem to be Idle, but in a 
controlled and prescribed environment. So, the learner first writes 
his/her code, and only then can run and/or step-through, as described.

+for ^Bart:
IIRC the early stages of the U.Mich/Coursera Py3 Pgmg course included 
coverage of "accumulators", which concept you have yet to learn - and 
certainly lists and ranges appear. Thus dealing with both of the 
conceptual errors causing grief in the original code-snippet. All the best!

Regards =dn