Skip to content

Add two numbers you were given · ⁨把读入的两个数相加⁩

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 把文字连起来了,而不是把数相加。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩