1000:A+B problem
Description
Calculate a+b.
Input
Two integers a and b, there is more than one input.
Output
Output a + b.
import sys
for line in sys.stdin:
data = line.split()
print(int(data[0])+int(data[1]))
注意:
1)sys.stdin 可以循环等待用户输入
2)split默认分割空格
本文详细介绍了一个经典的编程问题“A+B Problem”,并提供了使用Python语言解决该问题的代码示例。通过读取标准输入中的两个整数,然后输出它们的和,展示了如何使用sys模块进行输入输出操作。
1432

被折叠的 条评论
为什么被折叠?



