Advertisement
Nizarus

Get the key

Jul 23rd, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. def set_key():
  2.     print("There was the face of a sphinx")
  3.     print("riddle?")
  4.     print("what is that which has foor feet in the morning,\n two feet in the afternoon and three feet in the evening")
  5.     x=input()
  6.     print("I answered:"+str(x))
  7.    
  8.     if x=="human":
  9.       result=True
  10.     else:
  11.       result=False
  12.     return result
  13.        
  14.  
  15. class Room():
  16.   def __initi__(self, name, description, door="closed"):
  17.     self.name=name
  18.     self.description=description
  19.     self.door=door
  20.   def get_all(self):
  21.     if self.door=="closed":
  22.       return self.name, self.door
  23.     elif self.door=="open":
  24.       return self.description
  25.  
  26.   def set_all(self,nwname, nwdescription):
  27.     has_key=False
  28.     has_key=set_key()
  29.     self.name=nwname
  30.     self.description=nwdescription
  31.     if has_key==True:
  32.       self.door="open"
  33.     else:
  34.       self.door="closed"
  35.      
  36.      
  37.  
  38. k=Room()
  39. k.set_all("kitchen", "hot,hot,hot")
  40. print(k.get_all())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement