“So vergleichen Sie zwei Listenelemente nach Element in Python und return Matched Element zurück” Code-Antworten

So vergleichen Sie zwei Listenelemente nach Element in Python und return Matched Element zurück

>>> [i for i, j in zip(a, b) if i == j]
[5]
Innocent Ibex

So vergleichen Sie zwei Listenelemente nach Element in Python und return Matched Element zurück

lis =[]
#convert to list
a = list(data)
b = list(data)
def make_list():
    c = "greater than"
    d = "less_than"
    e = "equal"
    for first, first_te in zip(a, b):
        if first < first_te:
            lis.append(d)
        elif first > first_te:
            lis.append(c)
        else:
            lis.append(e)
    return lis

make_list()
Bad Butterfly

So vergleichen Sie zwei Listenelemente nach Element in Python und return Matched Element zurück

uncle(X,Y) :-
  parent(Z,Y), brother(X,Z). 

aunt(X,Y) :-
  parent(Z,Y), sister(X,Z). 

sibling(X, Y) :-
      parent(Z, X),
      parent(Z, Y),
      X \= Y.

sister(X, Y) :-
      sibling(X, Y),
      female(X).

brother(X, Y) :-
      sibling(X, Y),
      male(X).

parent(Z,Y) :- father(Z,Y).
parent(Z,Y) :- mother(Z,Y).

grandparent(C,D) :- parent(C,E), parent(E,D).

aunt(X, Y) :– female(X), sibling(X, Z), parent(Z, Y).
aunt(X, Y) :– female(X), spouse(X, W), sibling(W, Z), parent(Z, Y).

male(john).
male(bob).
male(bill).
male(ron).
male(jeff).

female(mary).
female(sue).
female(nancy).

mother(mary, sue).
mother(mary, bill).
mother(sue, nancy).
mother(sue, jeff).
mother(jane, ron).

father(john, sue).
father(john, bill).
father(bob, nancy).
father(bob, jeff).
father(bill, ron).

sibling(bob,bill).
sibling(sue,bill).
sibling(nancy,jeff).
sibling(nancy,ron).
sibling(jell,ron).
Bad Butterfly

Ähnliche Antworten wie “So vergleichen Sie zwei Listenelemente nach Element in Python und return Matched Element zurück”

Fragen ähnlich wie “So vergleichen Sie zwei Listenelemente nach Element in Python und return Matched Element zurück”

Weitere verwandte Antworten zu “So vergleichen Sie zwei Listenelemente nach Element in Python und return Matched Element zurück” auf TypeScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen