Block

中文

打印(“Hello”) [+][New version only] print(“Hello”) [+][Old version only]

注释[注释内容][New version only] comment out[Comment...][Old version only]

(获得输入)[New version only] (get input)[Old version only]

(打印(“你的名字？”)并获得输入)[New version only] (ask(“Your name?”)and get input)[Old version only]

导入[ ] [+][New version only]

导入[ ]为[? v] [+][New version only]

从[ ]导入[ ][New version only]

执行代码[# 输入代码并执行][New version only] [# Enter your code and execute][Old version only]

([# 输入代码并执行])[New version only] ([# Enter your code and execute])[Old version only]

### Control  /控制

重复执行(20)次[New version only] repeat(20)times[Old version only]

使用变量([i v])遍历(序列(0)到(10)前 [-][+])[New version only] count with([i v])in(range from(0)to(10) [-][+])[Old version only]

当< >重复执行[New version only] while< >repeat[Old version only]

 如果< >
否则 [-][+]
else [+]

退出循环[New version only] quit loop[Old version only]

跳过本次循环，进入下一次循环[New version only] continue with next iteration of loop[Old version only]

[当发生异常 v]:(任意错误 v) [+]
[except v]([TypeError v]) [+]

#### Time Library/Time库

等待(1)秒[New version only] wait(1)seconds[Old version only]

(当前时间)[New version only] (get current time)[Old version only]

### Operators  /运算

((0))

((1)[+ v](1))

((1)^(1))[New version only] ((1)[^ v](1))[Old version only]

((64)÷(10)的余数)[New version only] (remainer of(64)(10))[Old version only]

((-2.5)的绝对值)[New version only] (absolute value of(-2.5))[Old version only]

(四舍五入(3.14) [+])[New version only]

(-(1))[New version only]

<(0)[= v](0)>

<< >[且 v]< >>[New version only] << >[and v]< >>[Old version only]

<[成立 v]>[New version only] <[true v]>[Old version only]

<< >不成立>[New version only] <not< >>[Old version only]

<([a v])[是 v](None)>[New version only] <([a v])[is v](None)>[Old version only]

#### Math Library/Math库

([向上取整 v](3.1))[New version only] (round[up v](3.1))[Old version only]

([ln v](10))

([sin v]((45)度))[New version only] ([sin v](45)degrees)[Old version only]

([asin v](0.5))

((10)的算数平方根)[Sic][New version only] ([arithmetic square root v](0))[Old version only]

((5)的阶乘)[New version only] (factorial of(5))[Old version only]

(e)

(π)

#### Random Library/Random库

(0到1随机浮点数)[New version only] (random floating-point number)[Old version only]

(在(1)到(100)间随机一个整数)[New version only] (random integer from(1)to(100))[Old version only]

(在(1.234)到(3.456)间随机一个浮点数)[New version only] (random floating-point number from(1.234)to(3.456))[Old version only]

(在([List v])中随机选择一项)[New version only] (select a random item from([List v]))[Old version only]

### Variables  /变量

([i v])

设置([i v])为(0) [+][New version only] set([i v])to(0) [+][Old version only]

使([i v])[增加 v](1)[New version only] [increase v]([i v])by(1)[Old version only]

### Strings  /字符串

((“Hello”))

(将(“1”)转换为[整数类型 v])[New version only] (convert(“1”)to[integer type v])[Old version only]

((“Hello”)的长度)[New version only] (length of(“Hello”))[Old version only]

((“Hello”)的[小写字符 v])[New version only] ((“Hello”)to[lower case v])[Old version only]

<(“Hello”)[存在于 v](“Hello, World”)>[New version only] <(“Hello”)[in v](“Hello, World”)>[Old version only]

((“Hello”)[第 v](0)项)[New version only] ([No. v](0)item of(“Hello”))[Old version only]

(把(“Hello”)分开成列表 [+])[New version only] (separate(“Hello”)into a list [+])[Old version only]

(使用(“-”)将([List v])中的项连接成字符串)[New version only] (join items in([List v])as a string with(“-”))[Old version only]

((“Hello”)从第(0)项到第(3)项前的子字符串 [+])[New version only] (in(“Hello”)get substring from No.(0)to No.(3) [+])[Old version only]

### Lists  /列表

(列表(1)(1) [-][+])[New version only] (Lists(1)(1) [-][+])[Sic][Old version only]

添加(0)到([List v])末尾[New version only] append(0)to the end of([List v])[Old version only]

插入(0)到([List v])的第(0)项[New version only] insert(0)to([List v])as No.(0)item[Old version only]

删除([List v])[第 v](0)项[New version only] delete[No. v](0)item of([List v])[Old version only]

替换([List v])[第 v](0)项为(0)[New version only] replace[No. v](0)item of([List v])with(0)[Old version only]

(([List v])[第 v](0)项)[New version only] ([No. v](0)item of([List v]))[Old version only]

(([List v])的长度)[New version only] (length of([List v]))[Old version only]

((0)在([List v])中的位置)[New version only] (index of(0)in([List v]))[Old version only]

<(0)[存在于 v]([List v])>[New version only] <(0)[in v]([List v])>[Old version only]

(([List v])从第(0)项到第(3)项前的子列表 [+])[New version only] (in([List v])get sublist from No.(0)to No.(3) [+])[Old version only]

### Dictionary  /字典

(字典(“number1”):(0) [-][+])[New version only] (Dictionary(“number”):(1) [-][+])[Old version only]

设置([Dict v])键(“number”)的值为(1)[New version only] set(1)value to key(“number”)in dictionary([Dict v])[Old version only]

删除字典([Dict v])中的(“number”)[New version only] delete key([Dict v])in dictionary(“number”)[Old version only]

(字典([Dict v])键的总数)[New version only] (sum of keys in dictionary([Dict v]))[Old version only]

(字典([Dict v])键(“number”)的值)[New version only] (value of key(“number”)in dictionary([Dict v]))[Old version only]

<键(“number”)[存在于 v]([Dict v])>[New version only] <key(“number”)[in v]([Dict v])>[Old version only]

### Functions  /函数

定义函数[function] [set][New version only] declare a function[function] [-][+][Old version only]

返回(0) [-][+][New version only] return(0) [-][+][Old version only]

(parameter[? v])[Old version only]

声明([i v])为全局变量 [+][New version only] declare([a v])as global variable [-][+][Old version only]

### Turtle Library  /海龟库

**ℹ️This article is missing context.**
You need to edit this page to improve this article.
## Blocks that are not in the block list

(序列(0)到(10)前 [-][+])[New version only] (range from(0)to(10) [-][+])[Old version only]

([TypeError v])[Old version only]

(None)

(param1)[New version only]

1. ↑ This block means “import [ ]”(import module(s)).
2. ↑ This block means “import [ ] as [? v]”(import module(s) as another name(s)).
3. ↑ This block means “from [ ] import [ ]”(import a variable from a module).