You're given a mystery `puzzlebox` object. Examine it to make the tests pass and solve this kata.

Difficulty: introductory

Starter code:

def answer(puzzlebox):
	

Solutions:
def answer(puzzlebox):
    return 42

def answer(puzzlebox):
    #print(dir(puzzlebox))
    #puzzlebox.hint
    #print(puzzlebox.hint_two)
    #print(puzzlebox.lock(puzzlebox.key))
    return 42
    pass

# 09/01/2019
# I did all the work in the Sample Test section, then after submitting my answer, all of my work in the Sample Test section is gone.  
# So I'm doing this over and will incude my test data here as so it does not vanish when submitting the work. 
# I think from now on I will use my local machine so I don't loose all of my testing steps and have to do it all over again.

def answer(puzzlebox):  
    # Print statements are your friend.
    return(42)
    
#*** Below is the test dataand process I used to figure out that returning then number 42 is the the solution to the challenge ***

#Printing attributes of puzzlebox
print((dir(puzzlebox))) # Returns the puzzlebox object attributes
print((list(dir(puzzlebox))[25:30])) #prints attributes with values from puzzlebox [answer, hint, hint_two, key, lock]

#See values assigned to the puzzlebox object
print((puzzlebox.answer))      # returns "Ha, not quite that easy."
print((puzzlebox.hint))        # returns "How do you normally unlock things?
print((puzzlebox.hint_two))    # returns "The lock attribute is a method.  Have you called it with anything yet? "   
print((puzzlebox.key))         # returns "50", but running code again returns "78", then "57", so key is a random number
print((puzzlebox.lock))        # returns "<bound method Puzzlebox.lock of The built-in dir() function is useful. 
                             # Continue adding print statements till you know the answer.>

#Try passing stuff to the lock function as suggested by hint_two
num = 2
float = 2.3
bool = False
str = "hello"

print((puzzlebox.lock(num)))             # returns "Did you know the key changes each time you print it?"
print((puzzlebox.lock(float)))           # returns "This method expects an integer."
print((puzzlebox.lock(bool)))            # return  "This method expects an integer."
print((puzzlebox.lock(str)))             # returns "This method expects an integer."
print((puzzlebox.lock(puzzlebox.key)))   # returns "You put the key in the lock! The answer is, of course, 42. 
                                       # Return that number from your answer() function to pass this kata."
                                       # HOORAY!  Just return the number 42!




import random


class Puzzlebox(object):
    """Puzzlebox for codewars kata."""

    def __init__(self):
        self.key = random.randint(1, 99)

    answer = "Ha, not quite that easy.\n"

    hint = "How do you normally unlock things?\n"
        
    hint_two = "The lock attribute is a method. Have you called it with anything yet?\n"

    def lock(self, *args):
        if len(args) != 1:
            return "This method expects one argument.\n"
        elif type(args[0]) != int:
            return "This method expects an integer.\n"
        elif args[0] != self.key:
            return "Did you know the key changes each time you print it?\n"
        else:
            return "You put the key in the lock! The answer is, of course, 42. Return that number from your answer() function to pass this kata.\n"

    def __repr__(self):
        return "The built-in dir() function is useful. Continue adding print statements till you know the answer.\n"

def answer(puzzlebox):
    return 42
    
print((answer(puzzlebox)))



#print(dir(puzzlebox))
#print("The answer component of puzzlebox is {}.".format(puzzlebox.answer))
#print("The hint component of puzzlebox is {}.".format(puzzlebox.hint))
#print("The hint_two component of puzzlebox is {}.".format(puzzlebox.hint_two))
#print("The key component of puzzlebox is {}.".format(puzzlebox.key))
#print("The lock component of puzzlebox is {}.".format(puzzlebox.lock))
    
def answer(puzzlebox):
    return 42

#The answer component of puzzlebox is Ha, not quite that easy.



def answer(puzzlebox):

    return 42


print((type(dir(puzzlebox))))
for i in dir(puzzlebox):  
    print(i)
      
      
x = Puzzlebox()
print(x)
print((x.answer))
print((x.hint))
print((x.hint_two))
print((x.key))
print((x.lock(x.key)))
# x.lock(x.key)


def answer(puzzlebox):
    # Print statements are your friend.
    print(dir(puzzlebox))
    #print(puzzlebox.answer)
    print(puzzlebox.hint)
    print(puzzlebox.hint_two)
    print(puzzlebox.key)
    print(puzzlebox.lock(puzzlebox.key))
    return 42

def answer(puzzlebox):
    #print(puzzlebox.key)
    k=puzzlebox.key
    print(puzzlebox.lock(k))
    return 42

def answer(x):
    return 42

def answer(puzzlebox):
    return 42
    #print(dir(puzzlebox)
    # Print statements are your friend.
    
print(dir(puzzlebox))
print(puzzlebox.answer)
print(puzzlebox.hint)
print(puzzlebox.hint_two)
print(puzzlebox.key)
print(puzzlebox.lock)
print( puzzlebox.lock(puzzlebox.key))
print(puzzlebox.key)