Skip to main content
 首页 » 编程设计

python之列出重叠查找器

2025年05月04日20dudu

<分区>

我有两个列表:

a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] 
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] 

需要找到重叠的元素

我正在做作业。

  if (a[i]==b[i]): 
    print(i)``` 
 
But I got this error: 
IndexError: list index out of range, 
 
 
I expect result: 
1 , 2 , 3 , 5 , 8 , 13