I want to parse two decremental range to zip function for comparison
This is my code:
data=[('85','51','56','35','33','73','24','90','71','50'),
('47','58','13','65','59','16','89','73','85','56'),
('25','50','63','56','32','72','16','04','46','33'),
('70','71','44','28','06','17','01','76','38','66'),
('21','86','16','28','56','55','06','49','50','78'),
('62','60','78','16','65','49','55','79','24','27'),
('90','27','52','70','54','03','87','34','57','71'),
('08','43','90','44','27','52','40','04','85','58'),
('87','88','64','57','49','39','24','32','82','17'),
('32','69','84','57','49','71','22','70','48','72'),
('07','84','11','61','26','67','05','19','59','16'),
('44','33','10','89','06','24','86','07','55','82'),
('51','09','88','26','07','01','58','57','53','45'),
('70','69','54','25','35','15','61','79','38','82'),
('75','03','68','88','90','23','51','46','58','32'),
('88','10','41','66','32','63','67','84','47','05'),
('05','24','38','59','64','39','26','69','13','40')]
for m, n in zip([k for k in range(len(data),0,-1)], [l for l in range(len(data),0,-2)]):
print(set(m)&set(n))
I want my results to identify where there’s a common element after comparing the two ranges
New contributor
Adegbite Babatunde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
I guess you want this code
for i in [(m,n) for m, n in zip([k for k in range(len(data),0,-1)], [l for l in range(len(data),0,-2)])]:
print(set(i))
4