Home > other >  Help see bai
Help see bai

Time:09-16

Python

CodePudding user response:

 import itertools as it 

A1=[[3, 'European'], [2, 'America']]
A2=[[4, 'Asia'], [2, 'Oceania]]
A3=[[1, 'Asia'], [5, 'African']]
A4=[[4, 'African'], [3, 'Oceania]]
A5=[[2, 'European'], [5, 'America']]

D=[a1, a2, a3, a4, a5]
G=[list (zip (* _)) for _ in it. The product (a1, a2, a3, a4, a5)]
R=the filter (lambda x: len (set) (x [0])==5 and len (set) (x [1])==5, g)
Print (sorted (list (zip (* list (r) [0]))))


D={' monkey '5,' cat ': 5,' dog ', 5, 'deer: 5,' rabbit ': 5}
X=[[' monkey ', 'cat'], [' deer 'and' dog '], [' rabbit ', 'monkey'], [' dog ', 'rabbit']] * 2
For _ in x:
A=d.g et (_ [0], 0)
B=d.g et (_ [1], 0)
A=b - 1
D.u pdate ({_ [0] : a})

Print (sorted (d.i tems (), key=lambda x: x [1]))
  • Related