[Tutor] stopping at 100 entries - Use " for i in range(100)"
Michael Schmitt
lgwb@no_spam.home.com
Sat, 7 Oct 2000 16:21:05 -0500
How about this:
########################################
total = 0
for i in range(100):
total = total + input("next number please:")
print "The sum is now " , total
########################################
Michael Schmitt
-----Original Message-----
From: CMNOLEN@aol.com <CMNOLEN@aol.com>
To: tutor@python.org <tutor@python.org>
Date: Saturday, October 07, 2000 3:54 PM
Subject: [Tutor] stopping at 100 entries
>Hi-
>I am working through the 'Learning to Program Python' exercises. I had no
>trouble with the first exercise, a program to accept entries of numbers,
>tallying and reporting the sum until 100 is met or exceeded. I am now
>attempting to write one that will accept 100 entries, tracking the sum. I
>cannot seem to come up with a block that will stop the calculations after
the
>100th(or 10th or 5th etc.) entry. A point in the right direction would be
>greatly appreciated!cmn
>
>_______________________________________________
>Tutor maillist - Tutor@python.org
>http://www.python.org/mailman/listinfo/tutor