I want understand how this word wrap program playing on input

Arup Rakshit ar at zeit.io
Sat Apr 6 11:38:12 EDT 2019


Hello,

DL, the book I am reading is https://leanpub.com/python-journeyman .. It is an awesome book. The code is in page #351.

David and Chris, The analogy you used to answer my questions were super helpful. I could answer my own question by putting some effort by dry running the code ofcourse. In that case, I am 100% sure the analogies were used in this email would never come to me. 

Thanks again to all of you.



Thanks,

Arup Rakshit
ar at zeit.io



> On 05-Apr-2019, at 1:24 AM, DL Neil <PythonList at DancesWithMice.info> wrote:
> 
> Arup,
> 
> On 5/04/19 7:33 AM, Arup Rakshit wrote:
>> I am reading a Python book, where the author used a simple word wrap program to explain another concept. But I am not understanding some parts of the program.
> ...
> 
> A technique for solving this sort of comprehension-problem is to simulate the operations of the computer/CPU on-paper. Instruction-by-instruction, write down the names of the objects instantiated and their (current) values. As you loop through the code, those (current) values change, and you will see exactly how they change - divining (and defining) the 'why', as you go...
> 
> Of course, only old-***s (like me) have the skills to handle pen/pencil and paper technology! So, may I recommend an excellent tool which will (hopefully) achieve the same ends for you: http://pythontutor.com/
> 
> 
> PS don't be shy about mentioning your "book", its "author", and its title (hey, go 'full-APA' adding ISBN, pageNR...). Such will be a credit to the author(s) and a possible recommendation/inspiration to fellow Pythonista!
> 
> -- 
> Regards =dn
> -- 
> https://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list