Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # class for a human function
- class Human:
- #initialisation method with internal data
- def __init__(self, name, body_temp, age, residence):
- self.name = name;
- self.body_temp = body_temp
- self.age = age
- self.residence = residence;
- pass
- #get status
- def status(self):
- print("Human name is ", self.name, ".")
- print("Body temperature is ", self.body_temp)
- print("Age is ", self.age)
- print("Residence is at ", self.residence)
- pass
- #set temperature
- def setTemperature(self, temp):
- self.temperature = temp
- pass
- pass
- jimmy = Human("Jimmy", 37, 23, "New York")
- jimmy.status()
- jimmy.setTemperature(40)
- jimmy.status()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement