# Python 常用内置方法(1)

内置函数基本用例，基本测试+执行，请选出以下**会抛出断言异常**的代码。

## template

```python
if __name__ == '__main__':
    assert abs(-1) == 1
    assert max(10, 100) == 100
    assert min(10, 100) == 10
    assert round(3.5) == 3
    assert pow(2, 4) == 16
    assert all([True, True]) == True
    assert any([True, False]) == True
    assert ascii('你') == "'\\u4f60'"
    assert bin(2) == '0b10'
    assert bool({}) == False
    assert bytes([0, 1]) == b'\x00\x01'
    assert str(1) == '1'
    assert callable(abs) == True
    assert chr(97) == 'a'
    assert 'count' in dir([])
    assert float(1) == 1.0
    assert '{}, {}, {}'.format('a', 'b', 'c') == 'a, b, c'
    assert hash("a") == hash(chr(97))
    assert hex(1) == '0x1'
    assert type({}) == type({'a': 1})
```

## 答案

```python
assert ascii('你') == "'\\u4f60'"
assert bin(2) == '0b10'
assert bytes([0, 1]) == b'01'
assert str(1) == 1
assert chr(97) == 'a'
assert '{}, {}, {}'.format('a', 'b', 'c') == 'a, b, c'
assert hex(1) == '0x1'
```

## 选项

### A

```python
assert abs(-1) == 1
assert max(10, 100) == 100
assert min(10, 100) == 10
assert round(3.5) == 3
assert pow(2, 4) == 16
assert float(1) == 1.0
```

### B

```python
assert all([True, True]) == True
assert any([True, False]) == True
assert bool({}) == False
assert callable(abs) == True
```

### C

```python
assert 'count' in dir([])
assert hash("a") == hash(chr(97))
assert type({}) == type({'a': 1})
```
