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,

Good choice! (thought I recognised the example-problem) The three books 
in the "Python Craftsman" series/bundle: "Apprentice", "Journeyman", and 
"Master" are a thoroughly recommendable resource. As the titles infer, 
they start at a beginner level and become more complex over time. Even 
seasoned pythonista can learn from them.

Did you start with "Apprentice" and work 'up'? How are you finding them? 
Are they recommendable to others?

Did the Python Tutor help you 'see' what was happening and how values 
were changing whilst the code executed?


Web-Ref:
https://leanpub.com/b/python-craftsman

Disclaimer:
I have no relationship with either resource, other than as a happy user.


On 7/04/19 3:38 AM, Arup Rakshit wrote:
> 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
> 

-- 
Regards =dn