Sum of few numbers by using for and range
Which course are you attempting?
What are you using as learning material?
(it seems ineffectual)
- further comments interspersed, below:-
On 18/02/19 5:30 AM, Chris Angelico wrote:
> On Mon, Feb 18, 2019 at 3:26 AM ^Bart <gabriele1NOSPAM at hotmail.com> wrote:
>> I need to do what I wrote in the subject but... I don't understand how
>> could I fix my code... :\
> When you want homework help, it is extremely useful to post the entire
> challenge you were given, not just a one-line summary. What are you
> actually expected to do? What are the restrictions?
Also, are you aware that there is a separate email list "for folks who
want to ask questions regarding how to learn computer programming with
the Python language and its standard library."?
> I suspect, from your last few posts, that you should not be taking
> particular challenges, but should instead go back to the basics of how
> Python works. Reread the earliest material in your course and make
As explained earlier, asking helpful people 'here' to complete the task
for you helps no-one!
- you haven't really learned, and are unlikely to have mastered
techniques necessary to pursue employment or hobby-interests, in future
- you've asked community-minded folk to give-up their time
- your trainer is unlikely to be fooled for long...
> sure you truly understand what is going on. Try to piece together what
> a section of code is doing, step by step. Write down on a piece of
> paper what the variables are at each point in the program. Then, AFTER
> doing the work manually, run the code and see if you were right.
I recently audited a set of courses (last one yet to be released) on
Coursera, out of U.Mich (Michigan, USA): Python 3 Programming
(https://www.coursera.org/specializations/python-3-programming). I'm not
recommending it particularly - it doesn't fit with my personal approach
(which may say more about me!)
NB Coursera uses a 'freemium' business model. In my context "audit"
meant 'evaluation', but in Coursera-jargon it means $free. Paying for
such a course adds invitations to participate in project work, (?)final
exam, and one hopes, earn a certificate.
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!
In 'the good old days', we used to talk about having a 'paper computer'.
In appearance, this was almost exactly like the above - where we could
'see' exactly (what we thought) was happening inside the CPU. It was a
testing/debugging tool before the first line of code hit the Python (or
whichever) interpreter/compiler. (who says Test-driven Development is a
"new" idea?). In short, it is an excellent tool for visualising learning!
NB There is a Python Debugger tool which operates similarly, but the
learning tool is illustrative in nature, cf diagnostic.
Having mentioned U.Mich/Coursera, one of the most famous Python courses
available over-the-Internet is Dr Chuck's "Python for Everyone". I'm not
aware if he has upgraded those to use the same active textbook tool.
That said, it is an enormously-popular avenue for exploring Python!