# HELP! - Substitute a index value to another list value

**URL:** <https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215>\
**Category:** Lists-Logic\
**Tags:** dynamo\
**Created:** [September 20, 2018, 4:31pm UTC](https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215 "2018-09-20T16:31:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fansim](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@Fansim](https://forum.dynamobim.com/u/Fansim)\
**Post date:** [September 20, 2018, 4:31pm UTC](https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215/1 "2018-09-20T16:31:41Z")

</div>

I need some help!  
I have a LIST with 255 numeric elements like:

List 1:  
0 - A  
1 - B  
2 - C  
3 - C  
4 - A  
5 - A  
6 - B

and a LIST where i have this numbers defined with 102 univocal elements like:

List 2:  
0 - A  
1 - B  
2 - C

Now i must compare the two list for obtaining that same values have the same indexes of the second list with a result like:

List 3:

0 - 0  
1 - 1  
2 - 2  
3 - 2  
4 - 0  
5 - 0  
6 - 1

How can i do it with dynamo?

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [September 20, 2018, 4:38pm UTC](https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215/2 "2018-09-20T16:38:00Z")

</div>

Hi, and Welcome to the forum 🙂 can you show what you have tried so far? 🙂

---

<div class="post-metadata">

**Author:** ![Fansim](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@Fansim](https://forum.dynamobim.com/u/Fansim)\
**Post date:** [September 20, 2018, 5:21pm UTC](https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215/3 "2018-09-20T17:21:18Z")

</div>

Here You Are!

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/a/ea192965cc645f8368cb32588b823ab435c73645.png)

---

<div class="post-metadata">

**Author:** ![Fansim](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@Fansim](https://forum.dynamobim.com/u/Fansim)\
**Post date:** [September 20, 2018, 5:50pm UTC](https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215/4 "2018-09-20T17:50:03Z")

</div>

Here there is the definition.

[Enumerazione per Area\_2.dyn](https://forum.dynamobim.com/uploads/short-url/a3x8Zu2CnGIDZfE5SaLyAZllvuK.dyn) (23.4 KB)

---

<div class="post-metadata">

**Author:** ![GregX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gregx/32/56837_2.png) [@GregX](https://forum.dynamobim.com/u/GregX)\
**Post date:** [September 21, 2018, 3:51pm UTC](https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215/5 "2018-09-21T15:51:13Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/c/fc71532b9da85ee9b61e0138caf70fc13de68d9f.png)  
Something like this?  
I thought I had to play around with list levels (the little arrow next to the inputs) but it worked on the first try

---

<div class="post-metadata">

**Author:** ![ricardoperucci](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@ricardoperucci](https://forum.dynamobim.com/u/ricardoperucci)\
**Post date:** [September 21, 2018, 9:39pm UTC](https://forum.dynamobim.com/t/help-substitute-a-index-value-to-another-list-value/26215/6 "2018-09-21T21:39:27Z")

</div>

```
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

list1 = IN[0]
list2 = IN[1]

listOut = []

for item in list1:

    for i, reference in enumerate(list2):
	
	    if item == reference:
		
		    listOut.Add(i)
		    break
OUT = listOut

```

Just use this python code!

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