osdir.com


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

I want understand how this word wrap program playing on input


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