I would like to know if a given strings starts with some strings from a list.
p1 = ["I2101", "I222", "I7102", "I252"]
g1 = ["I21", "I22", "I252"]
g2 = ["I71"]
for p in p1:
if p in g1:
print("grupo1")
elif p in g2:
print("grupo2")
It should show grupo1 , grupo1, grupo2, grupo1 but It only works with I252 because it's the same as g1[2]