Skip to content

Instantly share code, notes, and snippets.

@XanderVi
Last active June 23, 2018 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XanderVi/b2d073cb199a11ce2df8adbf50b3ed0b to your computer and use it in GitHub Desktop.
Save XanderVi/b2d073cb199a11ce2df8adbf50b3ed0b to your computer and use it in GitHub Desktop.
mission Vacation
AIRPLANE_SPEED = 900 # km/h
TRAIN_SPEED = 120 # km/h
CAR_SPEED = 100 # km/h
ONE_MILE = 1.609344 # km
AIRPLANE_PRICE = 100 # per 1h
TRAIN_PRICE = 1 # per 1h
CAR_PRICE = 1.5 # per 1h
class Transport(object):
def travel(self, distance, money):
self.distance = distance
self.money = money
d = self.miles_into_km(distance)
t = self.time(d)
p = self.price(t)
m = self.money_left(p)
return 'Distance: ..., Time: ..., Price: ..., Money left: ...'
def miles_into_km(self, text):
return 'right distance'
def time(self, distance):
raise NotImplementedError()
def price(self, travel_time):
raise NotImplementedError()
def money_left(self, travel_price):
raise 'my money'
class Airplane(Transport):
def time(self, distance):
speed = AIRPLANE_SPEED
return 'time'
def price(self, travel_time):
travel_price = AIRPLANE_PRICE
return 'price'
person_1 = Airplane()
person_1.travel('1860 miles', 21650)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment