daily pastebin goal
26%
SHARE
TWEET

BreedNameTreeFinder

a guest Jan 18th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //breedNode is an object of type node representing the root of the tree
  2.  
  3. letters = 'abcdefghijklmnopqrstuvwxyz'
  4.  
  5. name = input("Enter the name of a breed")
  6. breedNode = tree.root()
  7.  
  8. while True:
  9.     if name == breedNode.getBreed():
  10.         print(name + " is in the tree.")
  11.         break
  12.  
  13.     if letters.index(name[0].lower) < letters.index(breedNode.getBreed[0].lower):
  14.         breedNode = breedNode.getLeftNode()
  15.     else if letters.index(name[0].lower) > letters.index(breedNode.getBreed[0].lower):
  16.         breedNode = breedNode.getRightNode()
  17.  
  18.     if breedNode == null:
  19.         print(name + " is not in the tree")
  20.         break
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top