Python 7天快速入門完整視頻教程:https://www.bilibili.com/video/BV1o84y1Z7J1
Python 函數(shù)方法的類型注解
"""
函數(shù)(方法)的類型注解
形參注解
def add(x:int, y:int):
return x+y
返回值注解:
def 函數(shù)方法名(形參:類型,...形參:類型)-> 返回值類型:
pass
"""
def add(x: int, y: int) -> int:
return x + y
print(add(1, 2))