Python iterator for loop plus if statement nesting how to write [1 for i in x if i in y]


Hello, everyone. I have a question. I have a logic like this. Loop a list to determine whether each value of the list is within a variable string. If 1 is not returned, a specific value will not be returned. The sample code is shown in the figure. Now there are two problems: numbers in 1:int format cannot determine whether they are in a string (data in int format cannot be converted into strings It is best to skip) 2: a specific value cannot be returned when the value in the circular list is in the variable string.
I would like to ask whether this logic can be completed through this iterator in my diagram, and if you can, please help me correct it, thank you!

Apr.06,2022

sum (1 for i in x if str (I) in y)

Menu