My own family's search engine


#1
class Search(object):
  def __init__(self, name, age):
    self.name = name
    self.age  = age
  
  def search_result(self):
    print '%s is %s years old.' % (self.name, self.age)
  
hudson = Search('Hudson', 10)
weston = Search('Weston', 13)
colton = Search('Colton', 15)
search = raw_input('Who do you want to search? ')

‘’‘So I am trying to make it so the result of the raw_input variable will access the search_result based on the answer, so you do not have to type search_result(weston). Please help!’’’

  • a curious programer

#2

what value does the class have here? I am very confused by this starting code you provided, i think i would do it very differently

does it need to be able to search for name or age? Or both?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.