Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.