# rotate_left 函数

列表的元素向左移动，开头的元素移到末尾。

## 怎么写

### rotate_left(list)

移动一位。

**list**

列表。接受一个列表。

### rotate_left(list, n)

移动若干位。

**list**

列表。接受一个列表。

**n**

移动多少位。接受一个整数。

## 示例

- $\displaystyle \operatorname{rotate\_left}(\left[ 1, 2, 3 \right]) = \left[ 2, 3, 1 \right]$

  `rotate_left([1, 2, 3])`

  在求解器中，`rotate_left([1, 2, 3])` 的结果是 `[2, 3, 1]`。

  [在求解器中打开](https://zh.hilberon.com/?q=rotate_left%28%5B1%2C%202%2C%203%5D%29)
- $\displaystyle \operatorname{rotate\_left}(\left[ 1, 2, 3 \right], 2) = \left[ 3, 1, 2 \right]$

  `rotate_left([1, 2, 3], 2)`

  在求解器中，`rotate_left([1, 2, 3], 2)` 的结果是 `[3, 1, 2]`。

  [在求解器中打开](https://zh.hilberon.com/?q=rotate_left%28%5B1%2C%202%2C%203%5D%2C%202%29)

## 相关函数

- [rotate_right](https://zh.hilberon.com/library/rotate_right)

  列表的元素向右移动，末尾的元素移到开头。
- [riffle](https://zh.hilberon.com/library/riffle)

  在元素之间插入某个值后的列表。
- [select](https://zh.hilberon.com/library/select)

  列表中满足某个测试的元素。
- [reverse](https://zh.hilberon.com/library/reverse)

  逆序排列的列表。
- [sort](https://zh.hilberon.com/library/sort)

  按递增顺序排列的列表。
- [rest](https://zh.hilberon.com/library/rest)

  去掉第一个元素后的列表。

---
Source: https://zh.hilberon.com/library/rotate_left
