[Tutor] Teaching Python

Tahir Hafiz tahir.hafiz at gmail.com
Wed Jan 6 15:59:34 EST 2016


Yes that is a huge for loop.
I can do it like this but I won't try:
>>> for num in list(range(1000000)):
>>>   print(num)

Sort of strange that the school wanted so much looping for your grandson,
they could have picked a lower number to demonstrate a for loop.

By the way there is the tqdm module which will show the time of a for loop
in a nice way:
https://github.com/noamraph/tqdm


Cheers,
Tahir







On Wed, Jan 6, 2016 at 6:23 PM, yehudak . <katye2007 at gmail.com> wrote:

> My grandson Guy (8th grader) is learning Python at school. That's what made
> me teach myself Python programming as well.
> Yesterday he asked my help in his homework:
>
> Write a FOR-loop that prints all numbers up to 1000000
>
> Thank you, the gods of Ctrl+C
>
> Yehuda
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list