编写一个循环,从标准输入中读取正整数,并在读取非正整数时终止。循环结束后,它会自动在一行上打印出读取的所有偶数整数的总和。
number =int(input())
even_number = 0
while number >= 0:
if number % 2 == 0:
even_number += number
print(even_number)
number = int(input())
上面写着:
Exception occurred(, EOFError('EOF when reading a line',), )
Exception occurred(, EOFError('EOF when reading a line',), )
The value of _stdout is incorrect.
We think you might want to consider using: >
We think you might want to consider using: sum
We think you might want to consider using: +
Solutions with your approach don't usually use: +=