首页 > 其他分享 >def fun_1(self, nums: List[int]) -> List[int]:

def fun_1(self, nums: List[int]) -> List[int]:

时间:2022-12-12 13:57:37浏览次数:33  
标签:nums int self List str def

class Solution:
    def fun_1(self, nums: List[int]) -> List[int]:
        pass

其中def fun_1(self, nums: List[int]) -> List[int]:比较疑惑,查了查资料,发现这叫类型提示,3.5版本的新语法。
你写错了也不会影响程序运行,但是当然不建议这么做

def greeting(name: str) -> str:
    return 'Hello ' + name

greeting 函数中,参数name的类型是str,返回类型也是str。

标签:nums,int,self,List,str,def
From: https://www.cnblogs.com/xinxuann/p/16975844.html

相关文章