Add two numbers you were given · 把读入的两个数相加
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
This one builds on a lesson you haven't finished yet. Do that lesson first: · 此任务基于您尚未完成的课程。请先完成以下课程:
Python Basics · Python 基础 · Getting input · 获取输入 →
English
Add two numbers you were given
Read two whole numbers, one per line, and print their total. For 3 and 4, print 7.
Two reads, two int(...), then one +. Forget one int and you get 34 instead of 7 — Python joined the text rather than adding the numbers.
中文
把读入的两个数相加
读取两个整数,每行一个,打印它们的和。输入 3 和 4 时,打印 7。
读两次、转换两次、再做一次 +。少写一个 int,你会得到 34 而不是 7 —— Python 把文字连起来了,而不是把数相加。
Read two whole numbers, one per line, and print their total. For 3 and 4, print 7. · 读取两个整数,每行一个,打印它们的和。输入 3 和 4 时,打印 7。
Click Run to see the output here. · 点击“运行”查看此处输出。