我是靠谱客的博主 优雅身影,这篇文章主要介绍TypeError: 'int' object is not iterable,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
for i in len(nums): n=len(nums) for m in n: if nums[i]+nums[m]==target : return [i,m]

Python写循环程序的时候遇到 TypeError: ‘int’ object is not iterable,原因是循环中使用的应该是一组数

复制代码
1
2
3
4
5
6
7
8
9
10
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: for i in range(len(nums)): n=len(nums) for m in range(n): if nums[i]+nums[m]==target : return [i,m]

最后

以上就是优雅身影最近收集整理的关于TypeError: 'int' object is not iterable的全部内容,更多相关TypeError:内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部