adding all files done so far
This commit is contained in:
13
learning/property/property.py
Normal file
13
learning/property/property.py
Normal file
@@ -0,0 +1,13 @@
|
||||
class Celsius(object):
|
||||
"""docstring for Celsius"""
|
||||
def __init__(self, temperature=0):
|
||||
super(Celsius, self).__init__()
|
||||
self.temperature = temperature
|
||||
|
||||
@classmethod
|
||||
def from_fahrenheit(cls, temperature=32):
|
||||
temperature = (temperature - 32) / (9 / 5)
|
||||
return cls(temperature)
|
||||
|
||||
def to_fahrenheit(self):
|
||||
return (self.temperature * 1.8) + 32
|
||||
Reference in New Issue
Block a user