On Sun, May 6, 2018 at 5:05 PM, Alan Gauld <[email protected]> wrote: > On 6 May 2018, at 23:00, boB Stepp <[email protected]> wrote:
>>My understanding of best practice here is that I should not have any >>print() calls inside my generate_collatz_sequence() function. I >>_could_ store the generated sequence in a list and return it, but that >>does not seem like good use of RAM if some user-supplied seed value >>led to kazillions of Collatz sequence numbers being generated. > > The clue is in that last word. > Write a generator function that yields the intermediate results. Aha! Of course the book I am poking around in does not even cover generator functions ... But I will plow ahead as usual and implement your suggestion. Thanks, Alan! -- boB _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
