猿问

请问这题返回值为什么为None????

class Solution:    def intersect(self, nums1, nums2):        if len(nums1) < len(nums2):            self.so(nums1,nums2)        else:            self.so(nums2,nums1)        def so(self,nums1,nums2):        list1 = []        for i in range(len(nums1)):            if nums1[i] in nums2:                list1.append(nums1[i])                nums2.remove(nums1[i])        return list1def main():	xx = Solution()	b = xx.intersect([1,2,2,1],[2,2])	print(type(b))	print(b)	if __name__ == '__main__':	main()


Zr_0118
浏览 754回答 0
0回答

慕斯4360584

XDUCTHLCWXIUZPDCDSWECEGCARLCQHPWKMZGGEMWFGRJKOQDPZPNHMQFSTAUYISWXUOFPWEBQUOFHXKBVCPIWQXLREDEVYJBFNRIRMJZHDTUNMZPMOEBLIWRLSLMGGIFZTABXDBYSCERFNAAZJDQUKBIJNBZZWXRRBCDYDARYMQQREMZUKBVFJRBCJNZIIXAOCYSTLRHMTHPHFTKEWMGHDOPPTHVVEYAHMDBYQKYSIUUQBYCTUVRRCORCXULDQGPLCWQGXVZNNXHIQQKOVPPNTULMCNBGOKLFMUVZYGDFWAVGIQJXFPEBJYYHAYIOKPLIOMRREFZYUHYOBOBDRDDEHMEKKHKHQCNXDDYCNHROWUJIJXLGNRBJNDCDARLAKYPZVEZVFTHRPUHESCWDGXUOCJWTJGRELFVMUKGGFZOIMFNKVLKDNPJQHWKNDHBIYMKKSFDWYIZXEULCRYEFGRSTRXGGQJCDUALFFGAEKXHIFPZXMWDJWEEYCNQVDZORQEVMMAUYZSGMTYBLBCSJWNKUZWMTDUFHHSSGCFGHWOHDLIQPJCGCRSCZFMXERYVPOPEFVCFJNDWMMQNAKUUROYXUHFJYYLNXZYJKOOPWWTQQZCCCZZZNQXGGAKKMGAUSSNQWGAXWTIANMQGJGPJMWGDHOHRSLDKDHHYZCJNNHNUOPCHKAPHUVCMHNATCJXBIHYLPFMFMUYMTRO
随时随地看视频慕课网APP

相关分类

Python
我要回答