Skip to content

The first three letters · ⁨前三个字母⁩

English

The first three letters

word is "python". Store its first three characters in part using a slice.

⚠️ A slice stops before its second number. word[:3] gives three characters — positions 0, 1, 2 — and never position 3. So the number you write is the COUNT you want, not the last position.

中文

前三个字母

word 是 "python"。用切片把它的前三个字符存进 part。

⚠️ 切片在第二个数之前停下。word[:3] 给出三个字符 —— 位置 0、1、2 —— 不包括位置 3。所以你写的那个数是你想要的个数,不是最后一个位置。

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

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