# How to check if a specific number occurred in a list

**URL:** <https://forum.dynamobim.com/t/how-to-check-if-a-specific-number-occurred-in-a-list/74631>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [March 22, 2022, 8:28am UTC](https://forum.dynamobim.com/t/how-to-check-if-a-specific-number-occurred-in-a-list/74631 "2022-03-22T08:28:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vbaac](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@vbaac](https://forum.dynamobim.com/u/vbaac)\
**Post date:** [March 22, 2022, 8:28am UTC](https://forum.dynamobim.com/t/how-to-check-if-a-specific-number-occurred-in-a-list/74631/1 "2022-03-22T08:28:27Z")

</div>

Hi sirs,

I just want to seek advise on how to get the result as shown in the image below… I am kind of ran out of ideas… thanks in advance ^^

 ![Question](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/5/b54e7e9e29194a07f3481ce769ee24a7bb506d52.png)

---

<div class="post-metadata">

**Author:** ![volkan.isik](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/volkan.isik/32/134061_2.png) [@volkan.isik](https://forum.dynamobim.com/u/volkan.isik)\
**Post date:** [March 22, 2022, 8:59am UTC](https://forum.dynamobim.com/t/how-to-check-if-a-specific-number-occurred-in-a-list/74631/2 "2022-03-22T08:59:17Z")

</div>

Hi,  
Is something like this what you want to do? 🤔

 ![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/4/949f03f39c93a4a9cfaf9cad7b33940958bccc1e.png)

---

<div class="post-metadata">

**Author:** ![Elie.Trad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/elie.trad/32/110373_2.png) [@Elie.Trad](https://forum.dynamobim.com/u/Elie.Trad)\
**Post date:** [March 22, 2022, 12:03pm UTC](https://forum.dynamobim.com/t/how-to-check-if-a-specific-number-occurred-in-a-list/74631/3 "2022-03-22T12:03:49Z")

</div>

@vbaac something like this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/8/a8e0e19be71cbf9b4f5857789763c9ad9ec01627.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [March 22, 2022, 2:00pm UTC](https://forum.dynamobim.com/t/how-to-check-if-a-specific-number-occurred-in-a-list/74631/4 "2022-03-22T14:00:56Z")

</div>

First thing I notice is that `DuplicateItemIndices` doesn’t seem to be returning all the indices with duplicate items. You’ll want to remedy that.

Second thing is that you’re using longest lacing for the `==` comparison. You need to make sure you’re checking every item in the initial list with every duplicate item. `List.Contains` with cross-product lacing would be the most efficient.

Third thing is to then check if each sublist of items passes the overall check using something like `AnyTrue`. Since you have to check each duplicate item you’re left with a boolean for each one. This allows you to see if _any_ of those duplicates were found and gives you the final output that you’re looking for.

---

<div class="post-metadata">

**Author:** ![vbaac](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@vbaac](https://forum.dynamobim.com/u/vbaac)\
**Post date:** [March 23, 2022, 5:15am UTC](https://forum.dynamobim.com/t/how-to-check-if-a-specific-number-occurred-in-a-list/74631/5 "2022-03-23T05:15:37Z")

</div>

@volkan.isik @Elie.Trad @Nick_Boyts , thank you very much for all your inputs… I finally got the results I needed… ^^

 ![test](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/d/fd4f50a6f905c2816337baed5d2918ef3eb6d239.png)
