I need to do a pattern match using 2 integer inputs. Im clueless on how to do this, please help.
eg:
input1 = 1,2
input2 = 1,2,0,1,2
//// Instructions below ////
For a pattern to be found, input1 as a set must be found in input2.
Since there are 2 pattern of "1,2" in input2, hence
Output is 2 patterns found!
/////// more examples ///////
Another example to make things clearer, if my input1 is 1,2,0
Output will be 1 pattern found!
///// My current code /////
> input1 = (1,2)
> input2 = ('1','2','0','1','2')
> count = 0
> for x,y in input1:
> if x and y in input2: #if "1,2" is found in input2 then count +1
> count += 1
> print(count) # expected result should be 1 Pattern Found! since there is only one "1,2" in input2
***Im new to stackoverflow, the system close my question? but I'm still editing
it LOL
Aucun commentaire:
Enregistrer un commentaire