class AutoTaxi:
def __init__(self, car_number, location=0, mode="Normal"):
self.car_number = car_number
self.mode = mode
self.location = location
def calculate_fare(self, distance):
fare = 4000
if distance > 2000:
extra_distance = distance - 2000
fare += (extra_distance // 132) * 100
if self.mode == "Night":
fare *= 1.2
return fare
def switch_mode(self):
if self.mode == "Normal":
self.mode = "Night"
else:
self.mode = "Normal"
taxi = AutoTaxi("123가4567", location=0, mode="Normal")
distance = 5000
taxi.switch_mode()
fare = taxi.calculate_fare(distance)
print(fare)
To embed this project on your website, copy the following code and paste it into your website's HTML: