Forked from anonymous/gist:74c9837eaef5fd4777db31cf7d412767
Last active
April 14, 2016 07:46
-
-
Save tangentstorm/d7ceb95bda0ad95c74033330b83ddbf6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_ints(): | |
i = 0 | |
while True: | |
s = input('enter number[%i]:' % i) | |
try: | |
yield int(s); i+=1 | |
except ValueError: | |
if s == "": return | |
else: print "ignoring invalid number" | |
print(sum(read_ints())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment