# Python 函数的参数类型定义


### 函数的参数类型定义

#### 参数定义类型的方法

- `def person(name:str, age:int=33):`
 `print(name, age)`


  - 函数定义在python3.7之后可用
  - 函数不会对参数类型进行验证

#### 代码

```python
# coding:utf-8

def add(a: int, b: int = 3):
    print(a + b)


add(1, 2)
# add('hello', 'xiaomu')


def test(a: int, b: int = 3, *args: int, **kwargs: str):
    print(a, b, args, kwargs)


test(1, 2, 3, 4, name='小慕')


def test2(a: int, b, c=3):
    print(a, b, c)


test2(1, 3, 4)

```


