Nov-01-2020, 03:42 PM
Hello,
I would compare multiple elements with a previous tuple in a list of tuples.
Example :
Input :
The third has none number in common with the second, so it is false.
The fourth has one number in common with the third, so it is true.
In another code, I would check if a number is in the previous list with a difference of one (exemple : 3 in the second list, 4 in the third list).
Input :
Can you help me please ?
Thank you.
I would compare multiple elements with a previous tuple in a list of tuples.
Example :
Input :
Ts = [(45,50,30,21), (30,9,56,3), (56,10,21,4), (41,30,50,56)]Desired output :
Output:1 : false
2 : true
3 : false
4 : true
I would like to now when an element of a tuple is in the previous tuple. Here, the second have one common number with the first (30), so it is true.The third has none number in common with the second, so it is false.
The fourth has one number in common with the third, so it is true.
In another code, I would check if a number is in the previous list with a difference of one (exemple : 3 in the second list, 4 in the third list).
Input :
Ts = [(45,50,30,21), (30,9,56,3), (56,10,17,4), (41,30,50,56)]Desired output :
Output:1 : false
2 : false
3 : true
4 : false
I’ve made a lot of research and some attempts, nothing concluding.Can you help me please ?
Thank you.