Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The following code contains two semantic errors. Correct it so that it reads in integers until the user enters -1, and then prints the sum of the integers (8 points)
- def getLines():
- inputs = []
- while True:
- line = raw_input('Enter a positive integer, -1 to quit: ')
- if line == -1:
- break
- inputs.append(line)
- total = 0
- for e in getLines():
- total += e
- print total
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement