4
Opening lists:
B_I = ['Cab', 'Bou', 'Bou', 'RFF', 'RF1', 'Rf2', 'Cor']
Ba_F = ['Bou', 'Zez1', 'Zez2', 'Praca', 'Sro', 'Sro', 'Falag']
Then I did ........
Final=[] #lista com todos os barramentos sem repetir inicial e final
for a in range (0,len(Ba_I)):
if (Ba_I[a] not in Final and Ba_I[a]!=0):
Final.append(Ba_I[a])
for b in range (0,len(Ba_F)):
if (Ba_F[b] not in Final and Ba_F[b]!=0):
Final.append(Ba_F[b])
B_I_final = [Final.index(i) for i in B_I]
Ba_F_final = [Final.index(i) for i in Ba_F]
And it gives:
B_I_final = [0, 1, 1, 2, 3, 4, 5]
Ba_F_final = [1, 6, 7, 8, 9, 9, 10]
And now I needed to get the opposite of B_i_final and Ba_f_final..
I tried to make:
b_contr=[]
for x in B_I_final[::-1]:
b_contr.append(B_I_final[x])
and give me this for the final B_i_end:
[4, 3, 2, 1, 1, 1, 0]
and should give:
[5, 4, 3, 2, 1, 1, 0]