pastebin

Paste Search Dynamic
Recent pastes
factsKw
  1. factsKw=[['croaks','frog'],['eats flies','frog'],["frog","green"],
  2.          ['chirp','canary'],['sing','canary'],["canary","yellow"]]
  3. def check(str,factDb):
  4.     facts=[]
  5.     flag=true
  6.     while flag==true:
  7.         flag=false
  8.         for txt in str:
  9.             for A1 in factDb:
  10.                 if A1[1]==txt:
  11.                     tmp=[A1[0],txt]
  12.                     if not tmp in facts:
  13.                         facts+=[tmp]
  14.                         str+=[A1[0]]
  15.                         flag=true
  16.     return facts
  17. result=check(['green'],factsKw)
  18. print(result)
Parsed in 0.010 seconds